mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-15 17:10:51 -10:00
Merge pull request #1560 from esdrubal/xlstregression
[corlib] ModuleBuilder.GetMethodToken no longer has a module check.
This commit is contained in:
commit
ceef1e2379
2 files changed
+27
-2
No files matched your search
@@ -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 ();
|
||||
}
|
||||
|
||||
|
||||
@@ -360,6 +360,32 @@ namespace MonoTests.System.Reflection.Emit
|
||||
Assert.AreEqual ("Frub", mi.Name);
|
||||
}
|
||||
|
||||
[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 ()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user