Skip to content

Conversation

@pranavkm
Copy link
Contributor

No description provided.

@pranavkm pranavkm force-pushed the prkrishn/nullable-everywhere branch 2 times, most recently from 33b81dc to 3d25406 Compare May 15, 2021 22:00
@JamesNK
Copy link
Member

JamesNK commented May 17, 2021

Is the plan something like:

  1. Default to globally on
  2. Fix the remaining projects to remove their disables
  3. Remove the <nullable>enables</nullable> everywhere

I think there are a couple of projects that already have <nullable>disable</nullable>. Perhaps add a comment with the new disables to they're easy to tell apart.

@pranavkm
Copy link
Contributor Author

Yup, that's the plan.

I think there are a couple of projects that already have disable. Perhaps add a comment with the new disables to they're easy to tell apart.

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

@pranavkm pranavkm force-pushed the prkrishn/nullable-everywhere branch from 3d25406 to 2b8717d Compare May 18, 2021 21:22
@pranavkm pranavkm changed the base branch from prkrishn/nullable-mvc-3 to main May 18, 2021 21:22
@pranavkm pranavkm marked this pull request as ready for review May 18, 2021 21:25
Copy link
Member

@JamesNK JamesNK left a 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.

Comment on lines 19 to 23
<Nullable Condition="'$(Nullable)' == '' AND !('$(IsTestProject)' == 'true' OR
'$(IsTestAssetProject)' == 'true' OR
'$(ISBenchmarkProject)' == 'true' OR
'$(IsSampleProject)' == 'true' OR
'$(IsMicrobenchmarksProject)' == 'true')">enable</Nullable>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rhymes with

Suggested change
<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.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Member

@captainsafia captainsafia left a 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?

@JamesNK
Copy link
Member

JamesNK commented May 19, 2021

#5680

@pranavkm pranavkm merged commit 2105ef1 into main May 19, 2021
@pranavkm pranavkm deleted the prkrishn/nullable-everywhere branch May 19, 2021 16:00
@ghost ghost added this to the 6.0-preview5 milestone May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants