https://bugzilla.novell.com/show_bug.cgi?id=640780
https://bugzilla.novell.com/show_bug.cgi?id=640780#c0 Summary: TypeLoadException when implementing interface with static method in dynamic assembly Classification: Mono Product: Mono: Class Libraries Version: 2.8.x Platform: x86 OS/Version: Windows 7 Status: NEW Severity: Normal Priority: P5 - None Component: CORLIB AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0) Repro: using System; using System.Reflection; using System.Reflection.Emit; public class Program { static void Main() { AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("Dummy"), AssemblyBuilderAccess.Run); ModuleBuilder modb = ab.DefineDynamicModule("Dummy"); TypeBuilder tb1 = modb.DefineType("Interface", TypeAttributes.Interface | TypeAttributes.Abstract); tb1.DefineTypeInitializer().GetILGenerator().Emit(OpCodes.Ret); tb1.DefineMethod("m", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.Abstract); tb1.CreateType(); TypeBuilder tb2 = modb.DefineType("Class", TypeAttributes.Sealed); tb2.AddInterfaceImplementation(tb1); tb2.DefineMethod("m", MethodAttributes.Public | MethodAttributes.Virtual) .GetILGenerator().Emit(OpCodes.Ret); tb2.DefineDefaultConstructor(MethodAttributes.Public); Activator.CreateInstance(tb2.CreateType()); } } Reproducible: Always Steps to Reproduce: Compile & Run Actual Results: Unhandled Exception: System.TypeLoadException: Could not load type 'Class' from assembly 'Dummy, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invok eAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globa lization.CultureInfo culture) [0x00000] in <filename unknown>:0 at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Refle ction.Binder binder, System.Object[] parameters, System.Globalization.CultureInf o culture) [0x00000] in <filename unknown>:0 at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00 000] in <filename unknown>:0 at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00 000] in <filename unknown>:0 at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename u nknown>:0 at Program.Main () [0x00000] in <filename unknown>:0 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
