Bugzilla – Bug 319421
[GMCS] mono_object_get_virtual_method() fails to resolve virtual generic method
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by atsushi@ximian.com 2005-10-28 06:03:03 MST ---- The example code below results in g_assert() failure on resolving virtual generic method Foo<T>(): -------- class Base { public virtual void Foo<T> () {} } class Derived : Base { public override void Foo <T> () {} } class Driver { public static void Main () { new Derived ().Foo<int> (); } } Actual Results: g_assert() fails at object.c: line 1288 (mono_object_get_virtual_method): assertion failed (res) Expected Results: no run-time error. How often does this happen? consistently. Additional Information: This does not seem a gmcs bug; gmcs-compiled one works fine under .NET 2.0. The entire --trace results (I'm pasting here since it's short): ENTER: (wrapper runtime-invoke) System.Object:runtime_invoke_void_string (object,intptr,intptr,intptr)([System.OutOfMemoryException:01281FC0], 0022FD08, 00000000, 01151648, ) . ENTER: System.OutOfMemoryException:.ctor (string)(this:01281FC0[System.OutOfMemoryException object1288.exe], [STRING:01280FC8:Out of memory], ) . . ENTER: System.SystemException:.ctor (string)(this:01281FC0[System.OutOfMemoryException object1288.exe], [STRING:01280FC8:Out of memory], ) . . . ENTER: System.Exception:.ctor (string)(this:01281FC0[System.OutOfMemoryException object1288.exe], [STRING:01280FC8:Out of memory], ) . . . LEAVE: System.Exception:.ctor (string) . . . ENTER: System.Exception:set_HResult (int)(this:01281FC0[System.OutOfMemoryException object1288.exe], -2146233087, ) . . . LEAVE: System.Exception:set_HResult (int) . . LEAVE: System.SystemException:.ctor (string) . . ENTER: System.Exception:set_HResult (int)(this:01281FC0[System.OutOfMemoryException object1288.exe], -2147024882, ) . . LEAVE: System.Exception:set_HResult (int) . LEAVE: System.OutOfMemoryException:.ctor (string) LEAVE: (wrapper runtime-invoke) System.Object:runtime_invoke_void_string (object,intptr,intptr,intptr)[OBJECT:00000000] ENTER: (wrapper runtime-invoke) System.Object:runtime_invoke_void_string (object,intptr,intptr,intptr)([System.NullReferenceException:01281F88], 0022FD08, 00000000, 01151760, ) . ENTER: System.NullReferenceException:.ctor (string)(this:01281F88[System.NullReferenceException object1288.exe], [STRING:01283ED8:A null value was found where an object instance was required], ) . . ENTER: System.SystemException:.ctor (string)(this:01281F88[System.NullReferenceException object1288.exe], [STRING:01283ED8:A null value was found where an object instance was required], ) . . . ENTER: System.Exception:.ctor (string)(this:01281F88[System.NullReferenceException object1288.exe], [STRING:01283ED8:A null value was found where an object instance was required], ) . . . LEAVE: System.Exception:.ctor (string) . . . ENTER: System.Exception:set_HResult (int)(this:01281F88[System.NullReferenceException object1288.exe], -2146233087, ) . . . LEAVE: System.Exception:set_HResult (int) . . LEAVE: System.SystemException:.ctor (string) . . ENTER: System.Exception:set_HResult (int)(this:01281F88[System.NullReferenceException object1288.exe], -2147467261, ) . . LEAVE: System.Exception:set_HResult (int) . LEAVE: System.NullReferenceException:.ctor (string) LEAVE: (wrapper runtime-invoke) System.Object:runtime_invoke_void_string (object,intptr,intptr,intptr)[OBJECT:00000000] ENTER: (wrapper runtime-invoke) System.Object:runtime_invoke_void_string (object,intptr,intptr,intptr)([System.StackOverflowException:01281F50], 0022FD08, 00000000, 011517A0, ) . ENTER: System.StackOverflowException:.ctor (string)(this:01281F50[System.StackOverflowException object1288.exe], [STRING:01284F50:The requested operation caused a stack overflow.], ) . . ENTER: System.SystemException:.ctor (string)(this:01281F50[System.StackOverflowException object1288.exe], [STRING:01284F50:The requested operation caused astack overflow.], ) . . . ENTER: System.Exception:.ctor (string)(this:01281F50[System.StackOverflowException object1288.exe], [STRING:01284F50:The requested operation caused a stack overflow.], ) . . . LEAVE: System.Exception:.ctor (string) . . . ENTER: System.Exception:set_HResult (int)(this:01281F50[System.StackOverflowException object1288.exe], -2146233087, ) . . . LEAVE: System.Exception:set_HResult (int) . . LEAVE: System.SystemException:.ctor (string) . LEAVE: System.StackOverflowException:.ctor (string) LEAVE: (wrapper runtime-invoke) System.Object:runtime_invoke_void_string (object,intptr,intptr,intptr)[OBJECT:00000000] ENTER: (wrapper runtime-invoke) System.Object:runtime_invoke_void (object,intptr,intptr,intptr)(00000000, 0022FD28, 00000000, 01151E88, ) . ENTER: Driver:Main ()() . . ENTER: (wrapper managed-to-native) System.Object:__icall_wrapper_mono_object_new_ptrfree (intptr)(007388F0, ) . . LEAVE: (wrapper managed-to-native) System.Object:__icall_wrapper_mono_object_new_ptrfree (intptr)[.Derived:00CEDFE8] . . ENTER: Derived:.ctor ()(this:00CEDFE8[.Derived object1288.exe], ) . . . ENTER: Base:.ctor ()(this:00CEDFE8[.Derived object1288.exe], ) . . . LEAVE: Base:.ctor () . . LEAVE: Derived:.ctor () . . ENTER: (wrapper managed-to-native) System.Object:__icall_wrapper_compile_generic_method (object,intptr,intptr)([.Derived:00CEDFE8], 010A2D60, 010A56A8, ) ---- Additional Comments From atsushi@ximian.com 2005-10-28 07:53:40 MST ---- It seems that in mono_class_get_overrides_full() tdef->base is 0 for Derived class, so it just returns without filling overrides. ---- Additional Comments From martin@ximian.com 2005-11-03 03:22:13 MST ---- Fixed in SVN; added gtest-224.cs. Unknown operating system unknown. Setting to default OS "Other".