Bugzilla – Bug 317519
[GMCS] runtime cannot handle either generic "where" or overloaded generic methods
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by atsushi@ximian.com 2005-03-23 00:11:14 MST ---- The example code below cannot run under mono runtime. Note that the code won't compile with gmcs because of https://bugzilla.novell.com/show_bug.cgi?id=MONO73992 and https://bugzilla.novell.com/show_bug.cgi?id=MONO73993, so you will need MS csc unless those bugs got fixed. ---- using System; static class Test1 { public interface IOp<T> { T Func(uint v); } public struct Op : IOp<ushort>, IOp<uint> { ushort IOp<ushort>.Func(uint v) { return (ushort )(v * 2); } uint IOp<uint>.Func(uint v) { return v * 4; } } static void Foo<T,OP>(uint v) where T:struct where OP : IOp<T> { OP op = default(OP); System.Console.WriteLine( op.Func(v) ); } static public void Main() { Foo<ushort, Op>(100); Foo<uint, Op>(100); } }; ---- Actual Results: ** (test1.exe:6362): WARNING **: Missing method Func in assembly /xxx/test1.exe token a000004 Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object in (unmanaged) 0x80ccfe2 in <0x0000a> Test1:Main () Expected Results: under MS runtime, it outputs 200 400 How often does this happen? consistently. ---- Additional Comments From atsushi@ximian.com 2005-03-23 00:25:07 MST ---- Actually I tried by myself (it was reported bug) with the binary built with the latest CTP and modified runtime (version number). The output was ** ERROR **: ile metadata.c line 1729 (do_mono_metadata_parse_generic_class): assertion failed ((gclass->context->container = gklass->generic_container) != NULL) aborting... ---- Additional Comments From martin@ximian.com 2005-04-29 08:33:03 MST ---- Fixed in SVN. This bug depended on bug(s) 73992 73993. Unknown operating system unknown. Setting to default OS "Other".