[Mono-bugs] [Bug 361689] New: [SRE] Mono allows overriding a virtual method with a non-virtual override

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Feb 13 21:36:04 EST 2008


           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 at lists.ximian.com
        ReportedBy: gnorton at novell.com
         QAContact: mono-bugs at 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
                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 ();

Crashes on MS.net with:

System.TypeLoadException: Method 'Create' on type 'TheType' from assembly
'Assembly, Version=, 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.

More information about the mono-bugs mailing list