ImportReference throws NotImplementedException on core
See original GitHub issueI am using Fody to create a weaver that uses cecil.
When calling ModuleDefinition.ImportReference(MethodBase) on .NET Core passing a method from a generic class it throws a NotImplementedException. I believe I am hitting the exception case here from here.
For reference I have created a sample repository showing the issue here (full disclosure, the referenced dlls are from the distributed Fody NuGet, however the source appears to match for this particular case).
So my question is this, how should I go about getting a MethodReference from a System.Reflection.MethodBase object in .NET Core?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Why does NotImplementedException exist?
The exception is thrown when an invoked method is not supported. For instance when there is an attempt to read, seek, or write...
Read more >NotImplementedException Class (System)
The NotImplementedException exception is thrown when a particular method, get accessor, or set accessor is present as a member of a type but...
Read more >Resolving package references in .NET Core not supported?
NET Core assumes the published case, where all package references are copied ... ImportReference throws NotImplementedException on core #505.
Read more >Use of NotImplementedException
I am the "hard error" type of guy: I will throw an exception at the slightest hint that something might be wrong; I...
Read more >C# NotImplementedException
The NotImplementedException indicates in a clear way that the functionality being requested was simply not implemented. Exception. Example. The ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Let’s keep that open. I want to move to the .net standard 2 for the next release.
A much more robust approach than I described above is to make the reflection and metadata importers handle facade assemblies. I have put the helper code in atykhyy/cecil-msbuild-helper.