Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -5,7 +5,7 @@
// (C) 2004 Ximian, Inc. http://www.ximian.com
//
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System;
using System.Threading;

View File

@@ -37,7 +37,7 @@ using System.Configuration.Assemblies;
using System.Globalization;
using System.IO;
using System.Reflection;
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System.Reflection.Emit;
#endif
using System.Threading;
@@ -213,7 +213,7 @@ namespace MonoTests.System.Reflection
#endif
}
#if !MONOTOUCH && !MOBILE_STATIC // Reflection.Emit is not supported.
#if !MONOTOUCH && !FULL_AOT_RUNTIME // Reflection.Emit is not supported.
[Test]
[Category("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter
public void GetModules_MissingFile ()
@@ -265,7 +265,7 @@ namespace MonoTests.System.Reflection
public void Corlib_test ()
{
Assembly corlib_test = Assembly.GetExecutingAssembly ();
#if MONODROID || MOBILE_STATIC || __WATCHOS__
#if MONODROID || FULL_AOT_DESKTOP || __WATCHOS__
Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
Assert.IsNull (corlib_test.Evidence, "Evidence");
#elif MOBILE
@@ -474,8 +474,8 @@ namespace MonoTests.System.Reflection
// with the semantics of aot'ed assembly loading, as
// aot may assert when loading. This assumes that it's
// safe to greedly load everything.
#if MOBILE_STATIC
string [] names = { "mobile_static_corlib_test" };
#if FULL_AOT_DESKTOP
string [] names = { "testing_aot_full_corlib_test", "winaot_corlib_test" };
#else
string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "net_4_x_corlib_test", "corlib_plattest", "mscorlibtests", "BclTests" };
#endif
@@ -523,7 +523,7 @@ namespace MonoTests.System.Reflection
}
}
#if !MONOTOUCH && !MOBILE_STATIC // Reflection.Emit is not supported.
#if !MONOTOUCH && !FULL_AOT_RUNTIME // Reflection.Emit is not supported.
[Test]
public void Location_Empty() {
string assemblyFileName = Path.Combine (
@@ -1146,7 +1146,7 @@ namespace MonoTests.System.Reflection
Assert.AreEqual ("MonoModule", module.GetType ().Name, "#2");
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
Assert.AreEqual ("mscorlib.dll", module.Name, "#3");
#endif
Assert.IsFalse (module.IsResource (), "#4");

View File

@@ -31,7 +31,7 @@
using System;
using System.Threading;
using System.Reflection;
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;

View File

@@ -33,7 +33,7 @@ using NUnit.Framework;
using System;
using System.Threading;
using System.Reflection;
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
@@ -54,7 +54,7 @@ namespace MonoTests.System.Reflection
[TestFixture]
public class MethodInfoTest
{
#if MONOTOUCH || MOBILE_STATIC
#if MONOTOUCH || FULL_AOT_RUNTIME
// use an existing symbol - so we can build without dlsym. It does not matter that the signature does not match for the test
[DllImport ("libc", EntryPoint="readlink", CharSet=CharSet.Unicode, ExactSpelling=false, PreserveSig=true, SetLastError=true, BestFitMapping=true, ThrowOnUnmappableChar=true)]
#else
@@ -115,7 +115,7 @@ namespace MonoTests.System.Reflection
DllImportAttribute attr = (DllImportAttribute)((t.GetMethod ("dllImportMethod").GetCustomAttributes (typeof (DllImportAttribute), true)) [0]);
Assert.AreEqual (CallingConvention.Winapi, attr.CallingConvention, "#1");
#if MONOTOUCH || MOBILE_STATIC
#if MONOTOUCH || FULL_AOT_RUNTIME
Assert.AreEqual ("readlink", attr.EntryPoint, "#2");
Assert.AreEqual ("libc", attr.Value, "#3");
#else
@@ -287,12 +287,28 @@ namespace MonoTests.System.Reflection
class GBD_D : GBD_C { public new virtual void f () {} }
class GBD_E : GBD_D { public override void f () {} }
class GBD_E2 : GBD_D { }
class GBD_F : GBD_E { }
[Test]
public void GetBaseDefinition ()
{
Assert.AreEqual (typeof (GBD_A), typeof (GBD_C).GetMethod ("f").GetBaseDefinition ().DeclaringType);
Assert.AreEqual (typeof (GBD_A), typeof (GBD_C).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#1r");
Assert.AreEqual (typeof (GBD_D), typeof (GBD_D).GetMethod ("f").GetBaseDefinition ().DeclaringType);
Assert.AreEqual (typeof (GBD_D), typeof (GBD_D).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#2r");
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E).GetMethod ("f").GetBaseDefinition ().DeclaringType);
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#3r");
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E2).GetMethod ("f").GetBaseDefinition ().DeclaringType, "#4");
Assert.AreEqual (typeof (GBD_D), typeof (GBD_E2).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#4r");
Assert.AreEqual (typeof (GBD_D), typeof (GBD_F).GetMethod ("f").GetBaseDefinition ().DeclaringType, "#5");
Assert.AreEqual (typeof (GBD_D), typeof (GBD_F).GetMethod ("f").GetBaseDefinition ().ReflectedType, "#5r");
}
class GenericBase<T,H> {
@@ -397,7 +413,7 @@ namespace MonoTests.System.Reflection
[Test]
public void GetMethodBody ()
{
#if (MONOTOUCH || MOBILE_STATIC) && !DEBUG
#if (MONOTOUCH || FULL_AOT_RUNTIME) && !DEBUG
Assert.Ignore ("Release app (on devices) are stripped of (managed) IL so this test would fail");
#endif
MethodBody mb = typeof (MethodInfoTest).GetMethod ("locals_method").GetMethodBody ();
@@ -600,7 +616,7 @@ namespace MonoTests.System.Reflection
} catch (InvalidOperationException ex) {
}
}
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
public TFoo SimpleGenericMethod2<TFoo, TBar> () { return default (TFoo); }
/*Test for the uggly broken behavior of SRE.*/
[Test]
@@ -854,7 +870,7 @@ namespace MonoTests.System.Reflection
}
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
class GenericClass<T>
{
public void Method ()

View File

@@ -10,7 +10,7 @@
using System;
using System.Threading;
using System.Reflection;
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System.Reflection.Emit;
#endif
using System.Runtime.Serialization;
@@ -106,7 +106,7 @@ public class ModuleTest
}
// Some of these tests overlap with the tests for ModuleBuilder
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
[Test]
[Category("NotDotNet")] // path length can cause suprious failures
public void TestGlobalData () {
@@ -341,7 +341,7 @@ public class ModuleTest
Module m = typeof (ModuleTest).Module;
m.GetObjectData (null, new StreamingContext (StreamingContextStates.All));
}
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
[Test]
[Category ("AndroidNotWorking")] // Mono.CompilerServices.SymbolWriter not available for Xamarin.Android
public void GetTypes ()

View File

@@ -7,7 +7,7 @@
// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
//
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System;
using System.Collections;

View File

@@ -31,7 +31,7 @@ using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System.Reflection.Emit;
#endif
using System.IO;
@@ -355,7 +355,7 @@ namespace MonoTests.System.Reflection
get { return 99; }
}
}
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
[Test]
public void ConstantValue () {
/*This test looks scary because we can't generate a default value with C# */

View File

@@ -28,7 +28,7 @@
using System;
using System.Threading;
using System.Reflection;
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System.Reflection.Emit;
#endif

View File

@@ -24,36 +24,47 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if !MONOTOUCH && !MOBILE_STATIC
#if !MONOTOUCH && !FULL_AOT_RUNTIME
using System;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using System.Collections;
namespace MonoTests.System.Reflection.VisibilityTypes
{
[TestFixture]
public class VisibilityTests
{
static void DoesNotContain (IEnumerable collection, object val)
{
Assert.That(collection, Has.No.Member(val));
}
static void Contains (IEnumerable collection, object val)
{
Assert.That(collection, Has.Member(val));
}
[Test]
public void TestsExportedTypes ()
{
var types = typeof (VisibilityTests).Assembly.GetExportedTypes ();
// Test visibility means that the class is public by applying and on the 'public' visibility of the nested items.
CollectionAssert.DoesNotContain (types, typeof (InternalClass));
CollectionAssert.Contains (types, typeof (PublicClass));
DoesNotContain (types, typeof (InternalClass));
Contains (types, typeof (PublicClass));
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
}
[Test]
@@ -62,18 +73,18 @@ namespace MonoTests.System.Reflection.VisibilityTypes
var types = typeof (VisibilityTests).Module.GetTypes ();
// Test that all the types defined exist.
CollectionAssert.Contains (types, typeof (InternalClass));
CollectionAssert.Contains (types, typeof (PublicClass));
Contains (types, typeof (InternalClass));
Contains (types, typeof (PublicClass));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
}
class InternalClass