[Mono-bugs] [Bug 670331] New: mono_class_from_mono_type crashes with "mono_class_from_mono_type: implement me 0x50" on attributes referencing generics

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 8 11:50:32 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=670331

https://bugzilla.novell.com/show_bug.cgi?id=670331#c0


           Summary: mono_class_from_mono_type crashes with
                    "mono_class_from_mono_type: implement me 0x50" on
                    attributes referencing generics
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: david at dasz.at
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.84 Safari/534.13

When running the code below, the runtime dies with a SIGABRT instead of being
able to reflect the methods of the assembly.

This seems to be connected to a undefined meta-data around MonoTypeEnum.

Reproducible: Always

Steps to Reproduce:
1. compile the following code into an assembly
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Reflection;

    namespace ReflectionTester
    {
        [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
        public class TestCaseAttribute : Attribute
        {
            public TestCaseAttribute(object arguments) { }
        }

        class Program
        {
            private static readonly BindingFlags AllMembers =
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance |
BindingFlags.Static | BindingFlags.FlattenHierarchy;

            [TestCase(new Type[] { typeof(IEnumerable<string>),
typeof(IList<string>) })]
            public void Test(Type value, Type[] expected)
            {
            }

            static void Main(string[] args)
            {
                foreach (var type in typeof(Program).Assembly.GetTypes())
                {
                    Console.WriteLine("inspecting type {0}", type.FullName);
                    foreach (var method in type.GetMethods(AllMembers))
                    {
                        Console.WriteLine("\tinspecting method {0}",
method.Name);
                        foreach (var attribute in
method.GetCustomAttributes(true))
                        {
                            Console.WriteLine("\t\tfound attribute {0}",
attribute);
                        }
                    }
                }
            }
        }
    }

2. try to load the assembly and reflect on the methods attributes

Actual Results:  
david at squeeze:~/ReflectionTester$ mono --debug
ReflectionTester/bin/Debug/ReflectionTester.exe
inspecting type ReflectionTester.TestCaseAttribute
        inspecting method get_TypeId
        inspecting method GetCustomAttribute
        inspecting method GetCustomAttribute
        inspecting method GetCustomAttribute
        inspecting method GetCustomAttribute
        inspecting method GetCustomAttribute
        inspecting method GetCustomAttribute
        inspecting method GetCustomAttribute
        inspecting method GetCustomAttribute
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetCustomAttributes
        inspecting method GetHashCode
        inspecting method IsDefaultAttribute
        inspecting method IsDefined
        inspecting method IsDefined
        inspecting method IsDefined
        inspecting method IsDefined
        inspecting method IsDefined
        inspecting method IsDefined
        inspecting method IsDefined
        inspecting method IsDefined
        inspecting method Match
        inspecting method Equals
        inspecting method Equals
        inspecting method Finalize
                found attribute
System.Runtime.ConstrainedExecution.ReliabilityContractAttribute
        inspecting method GetType
        inspecting method MemberwiseClone
        inspecting method ToString
        inspecting method ReferenceEquals
                found attribute
System.Runtime.ConstrainedExecution.ReliabilityContractAttribute
        inspecting method InternalGetHashCode
        inspecting method obj_address
inspecting type ReflectionTester.Program
        inspecting method Test
mono_class_from_mono_type: implement me 0x50

* Assertion: should not be reached at class.c:5731

Stacktrace:

  at (wrapper managed-to-native)
System.MonoCustomAttrs.GetCustomAttributesInternal
(System.Reflection.ICustomAttributeProvider,System.Type,bool) <IL 0x00009,
0x0004f>
  at (wrapper managed-to-native)
System.MonoCustomAttrs.GetCustomAttributesInternal
(System.Reflection.ICustomAttributeProvider,System.Type,bool) <IL 0x00009,
0x0004f>
  at System.MonoCustomAttrs.GetCustomAttributesBase
(System.Reflection.ICustomAttributeProvider,System.Type) [0x00019] in
/srv/CCNet/mono/src/mono.git/mcs/class/corlib/System/MonoCustomAttrs.cs:95
  at System.MonoCustomAttrs.GetCustomAttributes
(System.Reflection.ICustomAttributeProvider,System.Type,bool) [0x00035] in
/srv/CCNet/mono/src/mono.git/mcs/class/corlib/System/MonoCustomAttrs.cs:138
  at System.MonoCustomAttrs.GetCustomAttributes
(System.Reflection.ICustomAttributeProvider,bool) [0x00029] in
/srv/CCNet/mono/src/mono.git/mcs/class/corlib/System/MonoCustomAttrs.cs:265
  at System.Reflection.MonoMethod.GetCustomAttributes (bool) [0x00000] in
/srv/CCNet/mono/src/mono.git/mcs/class/corlib/System.Reflection/MonoMethod.cs:277
  at ReflectionTester.Program.Main (string[]) [0x0005b] in
/home/david/ReflectionTester/ReflectionTester/Program.cs:32
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <IL 0x00049, 0x0007b>

Native stacktrace:

        mono() [0x48ac76]
        /lib/libpthread.so.0(+0xef60) [0x7f76ed3f8f60]
        /lib/libc.so.6(gsignal+0x35) [0x7f76ed0bb165]
        /lib/libc.so.6(abort+0x180) [0x7f76ed0bdf70]
        mono() [0x5cc5aa]
        mono() [0x5cc75b]
        mono(mono_class_from_mono_type+0x3a) [0x5302da]
        mono() [0x527d50]
        mono() [0x528411]
        mono(mono_custom_attrs_construct+0x7a) [0x5287fa]
        mono(mono_reflection_get_custom_attrs_by_type+0x160) [0x5289f0]
        mono() [0x4f2494]
        [0x4108aa10]

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
david at squeeze:~/ReflectionTester$


Expected Results:  
No error

-- 
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