2015-04-07 09:35:12 +01:00
|
|
|
using System;
|
|
|
|
|
2018-08-07 15:19:03 +00:00
|
|
|
interface II
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class X
|
|
|
|
{
|
|
|
|
static void Foo (II a = default (II), II b = default, II c = (II) null)
|
2014-08-13 10:39:27 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static int Main ()
|
|
|
|
{
|
|
|
|
// Check installed mscorlib
|
|
|
|
// Type is included in Mono 2.4+, and .NET 3.5 SP1
|
|
|
|
object o = typeof (System.Runtime.InteropServices.AllowReversePInvokeCallsAttribute);
|
|
|
|
|
|
|
|
// It should crash but double check it in case of very old old runtime
|
|
|
|
if (o == null)
|
|
|
|
return 1;
|
|
|
|
|
2015-04-07 09:35:12 +01:00
|
|
|
var consts = o.GetType ().Assembly.GetType ("Consts");
|
|
|
|
if (consts == null) {
|
|
|
|
// We could be bootraping on cygwin using .net runtime
|
|
|
|
var assembly = o.GetType ().Assembly;
|
|
|
|
if (assembly.GetName ().Version >= new Version (4, 0) && assembly.Location.Contains ("Microsoft.NET"))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
var field = consts.GetField ("MonoVersion");
|
|
|
|
if (field == null)
|
|
|
|
return 3;
|
|
|
|
|
|
|
|
Version version;
|
|
|
|
if (!Version.TryParse (field.GetValue (null) as string, out version))
|
|
|
|
return 4;
|
|
|
|
|
2017-10-19 20:04:20 +00:00
|
|
|
Version min_mono_version;
|
|
|
|
#if __MonoCS__
|
2018-08-09 08:23:40 +00:00
|
|
|
min_mono_version = new Version (5, 16);
|
2017-10-19 20:04:20 +00:00
|
|
|
#else
|
2018-05-10 08:37:03 +00:00
|
|
|
min_mono_version = new Version (5, 10);
|
2017-10-19 20:04:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (version < min_mono_version)
|
2015-04-07 09:35:12 +01:00
|
|
|
return 5;
|
|
|
|
|
2014-08-13 10:39:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|