[Mono-bugs] [Bug 599469] New: Generic class with nested class causes mono crash (with test case)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Apr 24 10:03:30 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=599469

http://bugzilla.novell.com/show_bug.cgi?id=599469#c0


           Summary: Generic class with nested class causes mono crash
                    (with test case)
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: ohh at scisoft.dk
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv:1.9.2.3)
Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)

I am making heavy uses of generics and nested types. I have managed to produce
a test case, which crashes on the mono runtime (2.6.4) but executes fine on
NET.

Reproducible: Always

Steps to Reproduce:
Simply build and execute the following small file:

-bash-4.0$ cat test.cs
public class Grid<CT>
        where CT : Grid<CT>.GPD.GC, new()
{
        public abstract class GPD
        {
                public GPD()
                {
                        ctInst = new CT();
                }

                public readonly CT ctInst;

                public abstract class GC
                {
                }
        }
}

public class H : Grid<H.MyCT>.GPD
{
        public class MyCT : GC
        {
                // When no explicit default constructor is present GMCS fails
to compile the file.
                // When it is present the execution crashes on mono.
                public MyCT () {}
        }
}

public class TheTest
{
        public static void Main (string[] args)
        {
                new H();
        }
}
-bash-4.0$ gmcs test.cs
-bash-4.0$ mono test.exe

Actual Results:  
The mono runtime crashes with this error:
-bash-4.0$ mono test.exe

** (test.exe:22729): WARNING **: mono_class_from_mono_type: implement me 0x00

**
ERROR:class.c:4757:mono_class_from_mono_type: code should not be reached
Stacktrace:


Native stacktrace:

        mono [0x80c6a44]
        [0xb7f71440]
        [0xb7f71402]
        /lib/i686/nosegneg/libc.so.6(gsignal+0x51) [0xb7cbe9a1]
        /lib/i686/nosegneg/libc.so.6(abort+0x17a) [0xb7cc032a]
        /lib/libglib-2.0.so.0(g_assertion_message+0x12d) [0xb7ee14dd]
        mono(mono_class_from_mono_type+0x62) [0x8195182]
        mono [0x81989dc]
        mono(mono_class_get_full+0x16f) [0x819798f]
        mono(mono_metadata_load_generic_param_constraints+0xf9) [0x8174f09]
        mono [0x8197e5b]
        mono [0x8197f9a]
        mono(mono_class_get_full+0xf9) [0x8197919]
        mono(mono_class_get+0x20) [0x81979d0]
        mono [0x817929e]
        mono(mono_metadata_parse_type_full+0xe6) [0x8178546]
        mono(mono_metadata_parse_type+0x36) [0x8179006]
        mono [0x817935d]
        mono(mono_type_create_from_typespec+0xc6) [0x8179636]
        mono [0x8197746]
        mono(mono_class_get_full+0x160) [0x8197980]
        mono [0x8197d13]
        mono(mono_class_get_full+0xf9) [0x8197919]
        mono(mono_class_get+0x20) [0x81979d0]
        mono [0x818d8bb]
        mono(mono_get_method_full+0x9f) [0x818d9cf]
        mono [0x8076db6]
        mono [0x805f0a8]
        mono [0x8060870]
        mono [0x806113f]
        mono(mono_runtime_exec_main+0xde) [0x810f84e]
        mono(mono_runtime_run_main+0x15a) [0x8111aba]
        mono(mono_main+0x1a9b) [0x80afb0b]
        mono [0x8058795]
        /lib/i686/nosegneg/libc.so.6(__libc_start_main+0xe6) [0xb7ca9a86]
        mono [0x80586d1]

Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted


Expected Results:  
On Microsoft .NET the program runs and terminates without any output:

C:\Users\ohh\work\mono>csc Test.cs
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.4016
til Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. Alle rettigheder forbeholdes.


C:\Users\ohh\work\mono>Test.exe

C:\Users\ohh\work\mono>

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list