anchor.diff:  type private UriInfo = { Path : string; Query : string }
   
   let private uriInfo (uri : Uri) (source : string) = 
  +
       let fragPos = source.IndexOf("#")
       let queryPos = source.IndexOf("?")
       let start = source.IndexOf(uri.Host) + uri.Host.Length
  
positive.code:         pathField.SetValue(uri, uriInfo.Path)
          queryField.SetValue(uri, uriInfo.Query)
  
          uri))
  
  let private isMono =
      let uriType = typeof<Uri>
      (uriType.GetField("m_Flags", privateInstanceFlags) = null)
  
  let private hasBrokenDotNetUri =
      if isMono then false
      else
          let uriType = typeof<Uri>
          //ShouldUseLegacyV2Quirks was introduced in .net 4.5
          //Eventhough 4.5 is an inplace update of 4.0 this call will return 
          //a different value if an application specifically targets 4.0 or 4.5+
          let legacyV2Quirks = uriType.GetProperty("ShouldUseLegacyV2Quirks", BindingFlags.Static ||| BindingFlags.NonPublic)
          match legacyV2Quirks with
          | null -> true //neither 4.0 or 4.5
          | _ ->
              let isBrokenUri = unbox (legacyV2Quirks.GetValue(null, null))
              if not isBrokenUri then false //application targets 4.5
              else
                  //4.0 uses legacyV2quirks on the UriParser but you can set
                  //  <uri>
                  //    <schemeSettings>
                  //      <add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes" />
                  //          </schemeSettings>
                  //  </uri>
                  //
                  //  this will fix AbsoluteUri but not ToString()
                  //  i.e new Uri("http://google.com/%2F").AbsoluteUri
  
negative.code:     let cachedToStringField = uriType.GetField("cachedToString", privateInstanceFlags)
      let cachedAbsoluteUriField = uriType.GetField("cachedAbsoluteUri",privateInstanceFlags)
  
      fun (uri : Uri) ->
      
          let source = string (sourceField.GetValue(uri))
          cachedToStringField.SetValue(uri, source)
          cachedAbsoluteUriField.SetValue(uri, source)
  