System.Uri.ToString behaviour change after VS2012 install

后端 未结 3 921
广开言路
广开言路 2021-01-04 00:54

After installing VS2012 Premium on a dev machine a unit test failed, so the developer fixed the issue. When the changes were pushed to TeamCity the unit test failed. The pro

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-04 01:52

    In that situation you can't do like that. The main issue is the character "¶".

    In .Net we got a problem on character ¶. You can make a research on that.

    Take the uri' parameters one by one. Add them by one by and compare them. May be you can use a method for "¶" character to create it or replace it.

    For example;

    Dim uri = New Uri("http://www.example.org/test?helloworld=foo%B6bar")
    
    Assert.AreEqual("http://www.example.org/test?helloworld=foo¶bar", uri.Host+uri.AbsolutePath+"?"+uri.Query)
    

    that'll work

    uri.AbsolutePath: /test

    url.Host: http://www.example.org

    uri.Query: helloworld=foo¶bar

提交回复
热议问题