[Runtime Error] MissingMethodException caused by using ToHashSet method
See original GitHub issueToday we crashed in too unpleasant bug in .NET Standard + Linq.Extras:
System.MissingMethodException Method not found: 'System.Collections.Generic.HashSet`1<!!0> Linq.Extras.XEnumerable.ToHashSet(System.Collections.Generic.IEnumerable`1<!!0>, System.Collections.Generic.IEqualityComparer`1<!!0>)'.
To reproduce it:
- Create a project
NetStandartProject
targeted to .netstandard2.0 - Add a method
void SomeMethod(int[] a) => a.ToHashSet();
- Create a second project
NetCoreProject
targeted to .netcoreapp2.1 or higher - Add
NetStandartProject
intoNetCoreProject
dependencies - Call
SomeMethod
fromNetCoreProject
- Get System.MissingMethodException
Here is a complete example solution: https://github.com/rodion-m/LinqExtrasRuntimeException. Just run NetCoreProject
.
I suggest to delete all methods like ToHashSet
from .netstandart target and let the developer write new HashSet(a)
instead of a.ToHashSet()
than crash in runtime with MissingMethodException
. I think you just should make .netstandart version of Linq.Extras
equal to .netcore version of Linq.Extras
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
System.MissingMethodException: Method not found?
It all compiles without error, but it gave a mysterious "Method not found" error when I tried to use the package.
Read more >View Results Error - Missing Method Exception
MissingMethodException : Method not found: 'System.Collections.Generic.HashSet`1<!!0> System.Linq.Enumerable.ToHashSet(System.Collections.
Read more >Enumerable.ToHashSet Method (System.Linq)
Creates a HashSet<T> from an IEnumerable<T> using the comparer to compare keys.
Read more >https://raw.githubusercontent.com/dotnet/samples/m...
Numerics Quaternion operator overloads should be using the respective methods Quaternion declares a handful of methods to perform addition, subtraction and ...
Read more >Changelog for Groovy 2.0.0
[GROOVY-5063] - Cannot set "-Werror" javac option when using Groovyc ant task. [GROOVY-5076] - the shorthand notation for Grab isn't working correctly; [GROOVY- ......
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 FreeTop 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
Top GitHub Comments
@rodion-m I published a new release: 5.0.0-beta.1, in which I removed the problematic methods. I also changed the TFMs (removed old ones, added new ones). Please let me know if it fixes the problem for you.
Great, thank you! I think we can close the issue then.