-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Nullable annotations for Microsoft.Extensions.Configuration
#57200
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
This library hasn't been annotated for nullability at all. |
@stephentoub Would PR that annotates it be accepted? If so, I can do it. |
Yes, that would be welcome. Thanks. |
Seconding that, we would welcome help annotating our last remaining libraries. This may help you: https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/api-guidelines/nullability.md Reach out if you need help from us. |
IConfiguration
this[]
and GetConnectionString()
Microsoft.Extensions.Configuration
Do you know why Visual Studio 2019 might not generate nullable errors even though nullable is enabled (I tried enabling it everywhere down to `#nullable enabled in the source file)? VS does generate them for other projects in |
Tagging subscribers to this area: @maryamariyan, @safern Issue DetailsDescriptionIndexer and Regression?No Other informationI'm willing to fix it myself
|
The library only has a netstandard2.0 and net461 configuration today: Line 4 in 3b40c7c
and we explicitly disable nullable warnings across the repo for such projects:
You can try overriding it by explicitly adding <NoWarn/> to the csproj, but I expect you may run into some additional complications, including the reasons why we suppress them for this configuration. For example, because of lack of annotations on Debug.Assert in the reference assemblies for those target frameworks, the compiler won't consider Debug.Assert(x != null) as part of its nullable flow analysis. The library will probably need a newer target framework added to do this correctly.
|
Cc @eerhardt |
Duplicate of #43605. I'm going to close this issue as there is no reason to track this in multiple places.
The plan for all Microsoft.Extensions.* libraries is to add a We've been adding the |
Description
Indexer and
GetConnectionString
can return null, but they are not annotated to indicate that.https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationExtensions.cs#L34
Regression?
No
Other information
I'm willing to fix it myself
The text was updated successfully, but these errors were encountered: