Gives a string comparison of ReferenceEquals in Mono

I create a Uri object in Mono (on a unix system), it is very simple (for example, on VStudio / Windows): a new Uri (" http://my.url_here.com/ "). Then I create another system object that uses Uri: HttpSelfHostConfiguration ().

In the HttpSelfHostConfiguration source code, the received Uri will be checked using the following if-statement if (checked in Mono sources):

if (!ReferenceEquals(baseAddress.Scheme, Uri.UriSchemeHttp) && !ReferenceEquals(baseAddress.Scheme, Uri.UriSchemeHttps)) { throw Error.ArgumentUriNotHttpOrHttpsScheme("baseAddress", baseAddress); } 

and "if" fails because "ReferenceEquals (baseAddress.Scheme, Uri.UriSchemeHttp)" returns false, means that for Mono (works on Unix) baseAddress.Scheme is not equal to Uri.UriSchemeHttp.

Please note that debugging is confirmed in Mono (Unix), which is: baseAddress.Scheme = "http" and Uri.UriSchemeHttp = "http".

In VStudio, this works fine.

Can someone help me understand how ReferenceEqual works in Mono (Unix) and, most importantly, how can I create a valid Uri in Mono that pass the validation using the if statement above?

Many thanks

+4
source share

All Articles