-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Runtime Error] MissingMethodException caused by using ToHashSet method #22
Comments
Hi @rodion-m, I think I see what the problem is...
It would be the easiest option, but it would be a breaking change for anyone currently using it, and I try to avoid that as much as possible. I had introduced new targets without ToHashSet in order to avoid an ambiguity at compile-time (#19), but I didn't anticipate that it would cause a runtime issue... So now, if I remove these targets (or add the ToHashSet method in these targets), I reintroduce the ambiguity. If I don't, things break at runtime in scenarios like yours. Looks like I have a choice between two bad options... In the long run, I guess I should probably remove those methods, since there will be less and less people targetings TFMs without them. But It'll have to be in a major version, since it's a breaking change. |
Yes, here is a real choice of lesser evil. And I think that runtime error - is the biggest evil. So you definitely should remove this bugged extension asap (it's very not good to get an exception where you least expect it). It's not a problem for developers to fix all calls to |
@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). |
Great. Thank you! |
@rodion-m I realize I never actually published the stable 5.0.0 with these changes.
In the end, I might not even need to publish a 5.x version at all, since there won't be breaking changes wrt 4.x (I'm undecided yet; maybe it's better to publish a 5.x anyway, because users who installed 5.0.0-beta.1 won't see a 4.x version as an upgrade) |
@rodion-m FYI I just published 5.0.0, using the approach described above |
Great, thank you! I think we can close the issue then. |
Today we crashed in too unpleasant bug in .NET Standard + Linq.Extras:
To reproduce it:
NetStandartProject
targeted to .netstandard2.0void SomeMethod(int[] a) => a.ToHashSet();
NetCoreProject
targeted to .netcoreapp2.1 or higherNetStandartProject
intoNetCoreProject
dependenciesSomeMethod
fromNetCoreProject
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 writenew HashSet(a)
instead ofa.ToHashSet()
than crash in runtime withMissingMethodException
. I think you just should make .netstandart version ofLinq.Extras
equal to .netcore version ofLinq.Extras
.The text was updated successfully, but these errors were encountered: