This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 32815 - PropertyInfo.Module throws System.NotImplementedException
Summary: PropertyInfo.Module throws System.NotImplementedException
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: CORLIB (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-08-06 03:59 UTC by Artur Grzegorzewicz
Modified: 2015-08-10 07:05 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Artur Grzegorzewicz 2015-08-06 03:59:23 UTC
While testing FluentNhibernate on Linux I've noticed that it throws System.NotImplementedException at  at System.Reflection.MemberInfo.get_Module (). It is working fine on .NET though.

The root cause of this is the implementation of their MemberEqualityComparer:

https://github.com/jagregory/fluent-nhibernate/commit/989ff8d686d76763f25b120f67b49c3aa7e04185

I was able to reproduce it using minimal test case (see code below):

using System;
using System.Reflection;

class Program
{
        class Test
        {
                public int TestProperty { get; set; }
        }

        static void Main(string[] args)
        {
                var i1 = typeof(Test).GetProperty("TestProperty");
                var i2 = typeof(Test).GetProperty("TestProperty");

                Console.WriteLine(Compare(i1, i2));
        }

        static public bool Compare(MemberInfo x, MemberInfo y)
        {
                return x.MetadataToken.Equals(y.MetadataToken) && x.Module.Equals(y.Module);
        }
}

Mono JIT compiler version 4.3.0 (Nightly 4.3.0.723/8f7b98b Tue Aug  4 09:31:21 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

Unhandled Exception:
System.NotImplementedException: The method or operation is not implemented.
  at System.Reflection.MemberInfo.get_Module () <0x7ff47ffb3e10 + 0x00095> in <filename unknown>:0
  at Program.Compare (System.Reflection.MemberInfo x, System.Reflection.MemberInfo y) <0x4102da60 + 0x00057> in <filename unknown>:0
  at Program.Main (System.String[] args) <0x4102cd40 + 0x00073> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NotImplementedException: The method or operation is not implemented.
  at System.Reflection.MemberInfo.get_Module () <0x7ff47ffb3e10 + 0x00095> in <filename unknown>:0
  at Program.Compare (System.Reflection.MemberInfo x, System.Reflection.MemberInfo y) <0x4102da60 + 0x00057> in <filename unknown>:0
  at Program.Main (System.String[] args) <0x4102cd40 + 0x00073> in <filename unknown>:0
Comment 1 Marek Safar 2015-08-10 07:05:50 UTC
Fixed in master and Mono 4.2

Note You need to log in before you can comment on or make changes to this bug.