-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enable Nullable in Main Directory.Build.Props, Add #nullable disable to .cs Files, and Clean Up Redundant Configurations #45522
base: main
Are you sure you want to change the base?
Conversation
v-wuzhai
commented
Dec 18, 2024
•
edited
Loading
edited
- Centralized Management: Enabling nullable reference types in the main Directory.Build.Props file ensures consistent default behavior across the entire repository.
- Gradual Transition: By adding #nullable disable at the top of each .cs file, excluding files in projects where nullable reference types are already enabled, nullable reference types can be gradually enabled without immediately affecting all files.
- Cleaning Up Redundant Configurations: Removing all enable and #nullable enable from the src and test directories avoids duplicate configurations, simplifies project files, and ensures consistency.
16dd053
to
ff0daa5
Compare
…nable-nullable-and-cleanup
@ViktorHofer @marcpopMSFT To ensure consistent default behavior across the entire repository, I've enabled nullable reference types in the main Directory.Build.Props file. This allows for a gradual transition by adding Could you help to fix the VMR build failures? |
The VMR is its own entity and doesn't inherit settings from the dotnet/sdk repo. Therefore you need to set the Nullable=enable default in src/SourceBuild/content/Directory.Build.props as well. |
@ViktorHofer The VMR still seems to be failing, with the following error message:
The default language version for 'netstandard2.0' appears to be 7.3, which seems incompatible with enabling nullable. So, do we need to explicitly set the language version to 8.0 or higher, or should we disable nullable for netstandard2.0? |
@v-wuzhai I pushed a commit into your branch. We had to set LangVersion explicitly in the VMR orchestrator. |
A couple more nullability errors:
pushed a fix |