Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2015-02-11 19:17:27 +0300
committerMarek Safar <marek.safar@gmail.com>2015-02-11 19:17:27 +0300
commitceef1e2379154c17492c2fba727a67a030511f78 (patch)
treee71be297060f969d2cf96ddb3ab4821a3e640a76 /mcs/class/corlib
parentf1006fbbe0065d9b7f5c431d7f0daa9e0a25417a (diff)
parent9eb81476bde34f7fd0ef9fb624b9bb1bbeaa0546 (diff)
Merge pull request #1560 from esdrubal/xlstregression
[corlib] ModuleBuilder.GetMethodToken no longer has a module check.
Diffstat (limited to 'mcs/class/corlib')
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs3
-rw-r--r--mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs26
2 files changed, 27 insertions, 2 deletions
diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
index e5326dc08f6..05bf17c6278 100644
--- a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
@@ -574,8 +574,7 @@ namespace System.Reflection.Emit {
{
if (entryPoint == null)
throw new ArgumentNullException ("entryPoint");
- if (entryPoint.DeclaringType.Module != this)
- throw new InvalidOperationException ("entryPoint is not contained in this module");
+
throw new NotImplementedException ();
}
diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs
index 783f0937f66..11c8e314d00 100644
--- a/mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection.Emit/ModuleBuilderTest.cs
@@ -361,6 +361,32 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
+ public void GetMethodTokenCrossMethodBuilders ()
+ {
+ AssemblyBuilder ab = genAssembly ();
+ ModuleBuilder moduleb = ab.DefineDynamicModule ("foo.dll", "foo.dll");
+
+ TypeBuilder tb = moduleb.DefineType ("foo");
+ MethodBuilder mb = tb.DefineMethod("Frub", MethodAttributes.Static, null, new Type[] { typeof(IntPtr) });
+ int tok = mb.GetToken().Token;
+ mb.SetImplementationFlags(MethodImplAttributes.NoInlining);
+ ILGenerator ilgen = mb.GetILGenerator();
+ ilgen.Emit(OpCodes.Ret);
+
+ tb.CreateType ();
+
+ var mi = (MethodInfo) moduleb.ResolveMember (tok);
+ Assert.IsNotNull (mi);
+
+ ModuleBuilder moduleb2 = ab.DefineDynamicModule ("foo2.dll", "foo2.dll");
+ var tok2 = moduleb2.GetMethodToken (mi).Token;
+
+ MethodBase mi2 = moduleb.ResolveMethod (tok2);
+ Assert.IsNotNull (mi2);
+ Assert.AreEqual ("Frub", mi.Name);
+ }
+
+ [Test]
public void ResolveMemberField ()
{
var assembly = genAssembly ();