Bugzilla – Bug 448558
gmcs emits unverifiable generic code
Last modified: 2008-11-25 16:56:31 UTC
Test sample: class T { public P GetService <P> () where P : class { return null; } } gmcs il: .method public hidebysig instance !!P GetService<class P>() cil managed { .maxstack 8 L_0000: ldnull L_0001: ret } csc il: .method public hidebysig instance !!P GetService<class P>() cil managed { .maxstack 1 .locals init ( [0] !!P local) L_0000: ldloca.s local L_0002: initobj !!P L_0008: ldloc.0 L_0009: ret } peverify says (out gmcs): [IL]: Error: [test.dll : T::GetService[P]][offset 0x00000001][found Nullobjref 'NullReference'][expected (unboxed) 'P'] Unexpected type on the stack. 1 Error(s) Verifying test.dll
*** This bug has been marked as a duplicate of bug 324319 ***