Bug 32815 - PropertyInfo.Module throws System.NotImplementedException
Summary: PropertyInfo.Module throws System.NotImplementedException
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
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)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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