By default mono doesnt trust any SSL connections. So if running on mono i'd like to give a message rather then throwing an exception.
How do i check if i am running under mono at runtime? (since at compile time the CLI wont know)
By default mono doesnt trust any SSL connections. So if running on mono i'd like to give a message rather then throwing an exception.
How do i check if i am running under mono at runtime? (since at compile time the CLI wont know)
I'll quote from the Mono site:
Having code that depends on the underlying runtime is considered to be bad coding style, but sometimes such code is necessary to work around runtime bugs
using System;
class Program {
static void Main ()
{
Type t = Type.GetType ("Mono.Runtime");
if (t != null)
Console.WriteLine ("You are running with the Mono VM");
else
Console.WriteLine ("You are running something else");
}
}
Couldn't you just catch the System.Net.WebException and pass your message up? This is approach #1 from the Mono site here: Using Trusted Roots Respectfully. There are a number of more (and a couple less) involved responses there if you'd like to do more, but catching the exception avoids the coding-to-runtime problem tobsen refers to.