https://bugzilla.novell.com/show_bug.cgi?id=361689


           Summary: [SRE] Mono allows overriding a virtual method with a
                    non-virtual override
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs@lists.ximian.com
        ReportedBy: [EMAIL PROTECTED]
         QAContact: mono-bugs@lists.ximian.com
          Found By: ---


The following testcase:

using System;
using System.Reflection;
using System.Reflection.Emit;

public interface IDelegateFactory {
        Delegate Create (Delegate del);
}

public class SreTest {
        static void Main (string [] args) {
                ModuleBuilder module = System.Threading.Thread.GetDomain
().DefineDynamicAssembly (new AssemblyName {Name = "Assembly"},
AssemblyBuilderAccess.RunAndSave).DefineDynamicModule ("Module", "Module.dll");
                TypeBuilder tb = module.DefineType ("TheType",
TypeAttributes.Public, typeof (object), new Type [] {typeof
(IDelegateFactory)});
                MethodBuilder mc = tb.DefineMethod ("Create",
MethodAttributes.Public, typeof (Delegate), new Type[] {typeof (Delegate)});
                ILGenerator gen = mc.GetILGenerator ();
                gen.Emit (OpCodes.Ldarg_0);
                gen.Emit (OpCodes.Ret);
                tb.DefineMethodOverride (mc, typeof
(IDelegateFactory).GetMethod ("Create"));

                tb.CreateType ();
                return;
        }
}


Crashes on MS.net with:

System.TypeLoadException: Method 'Create' on type 'TheType' from assembly
'Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' tried to
implement a method declaration with a different virtual state.


-- 
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  -  mono-bugs@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to