-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Turn on nullability for all src projects #32742
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
Conversation
33b81dc to
3d25406
Compare
|
Is the plan something like:
I think there are a couple of projects that already have |
|
Yup, that's the plan.
From the looks of it, they have comments and the ones that don't should be updated to have nullability enabled: https://github.com/dotnet/aspnetcore/search?l=XML&q=nullable%3Edisable |
3d25406 to
2b8717d
Compare
JamesNK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments to the existing nullable disables in Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj and Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj that these projects are obsolete.
eng/targets/CSharp.Common.targets
Outdated
| <Nullable Condition="'$(Nullable)' == '' AND !('$(IsTestProject)' == 'true' OR | ||
| '$(IsTestAssetProject)' == 'true' OR | ||
| '$(ISBenchmarkProject)' == 'true' OR | ||
| '$(IsSampleProject)' == 'true' OR | ||
| '$(IsMicrobenchmarksProject)' == 'true')">enable</Nullable> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rhymes with
| <Nullable Condition="'$(Nullable)' == '' AND !('$(IsTestProject)' == 'true' OR | |
| '$(IsTestAssetProject)' == 'true' OR | |
| '$(ISBenchmarkProject)' == 'true' OR | |
| '$(IsSampleProject)' == 'true' OR | |
| '$(IsMicrobenchmarksProject)' == 'true')">enable</Nullable> | |
| <Nullable Condition=" '$(Nullable)' == '' AND ( | |
| '$(IsImplementationProject)' == 'true' OR | |
| '$(IsAnalyzersProject)' == true OR | |
| '$(IsSpecificationTestProject)' == 'true') ">enable</Nullable> |
If that's what you meant, the suggestion is easier to read. Even better if analyzers and / or specification tests don't need nullability enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separately, may be good to add bits like AND ! $(RepoRelativeProjectDir.Contains('Tools') rather than enshrine exclusions we'll never remove elsewhere in the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't quite follow the second suggestion. Is this to exclude the eng tools?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second suggestion would remove the need for src/Tools/Directory.Build.props because $(RepoRelativeProjectDir) is the relative path from the repo root to the project folder.
/fyi src/ProjectTemplates/testassets/DotNetToolsInstaller is the only not-exactly-Tools folder the Contains(...) would match. I suspect a repetition w/ .Contains("tools") would be needed if you want to automatically exclude projects under src/Middleware/tools and the other 10 or so other tools folders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really want to get to the tools too (it validates the nullability of shared sources for e.g). Just not making it a priority for 6.0. Having it be an explicit nullable disabled makes it easier to find these exclusions. Let me know if you feel strongly about it.
Co-authored-by: Doug Bunting <[email protected]>
captainsafia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we tracking the disabled ones in an issue somewhere?
No description provided.