-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
4.7.2 introduces CS0121 #730
Comments
I've recreated the problem in a small project, which is available here: If you compile the site, it succeeds. As soon as you run it, you'll get:
In this case, both the call from |
Asp.net runtime compilation references the .net framework installed on your machine. Unfortunately, new API System.Linq.Enumerable.ToHashSet is added into 4.7.2 which causes the issue. So there are several options here:
|
This is affecting us as well, is this method also available for .NET Standard? I can't seem to find it anywhere. This leaves us in a state where some of our code has to get ToHashSet from our custom extension methods and some has to get it from .NET Framework. |
4.7.2 Update @RichardD2 :-D generic parameters was there but if you set text as BOLD, so it disappears in the preview. Thanks for the note. I changed BOLD to CODE and we can see parameters :-) |
@BcMartinSulcNess You're missing the type parameters, so that won't compile. It would actually be:
and:
It still requires changes to existing code which was working prior to the installation of 4.7.2 though. |
We also faced this issue, although dealing with Dot Net v.4.60 (started few months back). The code suggested by @BcMartinSulcNess worked for us. For some reason |
I think the only way to fix this would be introducing a .NET Standard 2.0.1 that targeted .NET Framework 4.7.2. Given the prevailing attitudes to "legacy", even changes like this to make upgrading easier, it seems unlikely :/ |
I have a number of WebForms sites which are not pre-compiled, targeting 4.5, which have been working for years.
The site references a class library which includes a custom
ToHashSet
extension method. This extension method is used in various places.After installing the Win10 April update - and thereby, .NET 4.7.2 - the site fails to compile. Each usage of the custom extension method from a class in the
App_Code
folder is flagged as ambiguous between my custom extension method and the newEnumerable.ToHashSet
extension method.Usages of my custom extension method in code-behind files are not marked as ambiguous.
I accept that the "web site" model is not recommended. However, rewriting several large sites to use the "web application" model is not an option.
The compiler is clearly capable of ignoring new APIs; otherwise, the code-behind code would not compile. So why is it not doing so for code in the
App_Code
folder?The text was updated successfully, but these errors were encountered: