[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
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 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
(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.
More information about the mono-bugs
mailing list