issue with ReferenceEquals string comparison in Mono

343 views Asked by At

I'm creating a Uri object in Mono (under unix system), this is very simple(like in VStudio/Windows): new Uri("http://my.url_here.com/"). Then I'm creating another system object which use the Uri: HttpSelfHostConfiguration().

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

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

and the "if" fails because "ReferenceEquals(baseAddress.Scheme, Uri.UriSchemeHttp)" return false, means that for Mono(running in Unix) baseAddress.Scheme is not equal to Uri.UriSchemeHttp.

Notice that is confirmed debugging in Mono(Unix) that: baseAddress.Scheme = "http" and Uri.UriSchemeHttp = "http".

Under VStudio this works perfect.

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

thanks a lot

0

There are 0 answers