-
Notifications
You must be signed in to change notification settings - Fork 4k
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
IntelliSense confused by Action<> overloads #63339
Comments
cc @mairaw |
This is not related to the tutorials but instead it's an IntelliSense issue. @jaredpar @terrajobst would you know who can help with this? |
@datvm would it be possible to share a repo with instructions on how to reproduce the issue? We can try to take a look. |
@eiriktsarpalis Hi, just create a new project with Worker template and you have the problem immediately in Github Repo if you still need it. It seems to list all members of |
Since this is happening in VS, you might be able to get better support if you file the issue through Visual Studio Help menu. |
Related VS feedback ticket https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1590331 |
I can confirm this is no longer an issue testing at v17.9.2. Do you want to close this? |
@datvm In general, the behavior described above is by design. In the face of incomplete code, the compiler may or may not be able to complete its overload resolution process down to a single set of types. When this step fails to produce a unique result, completion lists will attempt to include the union of possible results to best allow the user to bring the code from an incomplete state to a valid complete state. |
Description
I was trying to create a Windows Service in .NET 6 following this documentation.
I want to read the settings from
appsettings.json
so I added the following code:As you can see, IntelliSense seems to recognize there is
Configuration
property inservices
(instance ofIServiceCollection
instead ofHostBuilderContext
).However the code wouldn't compile because IServiceCollection does NOT have
Configuration
property, but HostBuilderContext does.I realized
ConfigureServices
method has 2 overload (actually there is one, the other is extension method):So in the case of using Extension Method, somehow IntelliSense thought
services
isHostBuilderContext
.Note: I already fixed my problem, just want to report strange behavior of IntelliSense that made me spend a lot of time figuring out why my code couldn't compile. Here's the fix if anyone is interested:
Configuration
Regression?
I don't know
Other information
Microsoft Visual Studio Community 2022
Version 17.0.0
VisualStudio.17.Release/17.0.0+31903.59
Microsoft .NET Framework
Version 4.8.04161
Installed Version: Community
The text was updated successfully, but these errors were encountered: