Skip to content
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

Change Nullable to default to enable in libraries src and ref projects #68102

Merged
merged 6 commits into from
Apr 25, 2022

Conversation

eerhardt
Copy link
Member

Now that 90% of our libraries are annotated for nulllable, it makes sense to have the default be enable. There are currently 26 libraries that aren't fully annotated yet:

Microsoft.Bcl.AsyncInterfaces
Microsoft.Extensions.DependencyInjection.Specification.Tests
Microsoft.Extensions.Hosting.Systemd
Microsoft.Extensions.Hosting.WindowsServices
Microsoft.NETCore.Platforms
Microsoft.XmlSerializer.Generator
System.CodeDom
System.ComponentModel.Composition.Registration
System.Composition
System.Composition.AttributedModel
System.Composition.Convention
System.Composition.Hosting
System.Composition.Runtime
System.Composition.TypedParts
System.Configuration.ConfigurationManager
System.Diagnostics.EventLog
System.Diagnostics.PerformanceCounter
System.DirectoryServices.AccountManagement
System.DirectoryServices.Protocols
System.IO.Ports
System.Management
System.Runtime.Caching
System.Security.Cryptography.Xml
System.Security.Permissions
System.ServiceModel.Syndication
System.Speech

@ghost
Copy link

ghost commented Apr 16, 2022

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

Issue Details

Now that 90% of our libraries are annotated for nulllable, it makes sense to have the default be enable. There are currently 26 libraries that aren't fully annotated yet:

Microsoft.Bcl.AsyncInterfaces
Microsoft.Extensions.DependencyInjection.Specification.Tests
Microsoft.Extensions.Hosting.Systemd
Microsoft.Extensions.Hosting.WindowsServices
Microsoft.NETCore.Platforms
Microsoft.XmlSerializer.Generator
System.CodeDom
System.ComponentModel.Composition.Registration
System.Composition
System.Composition.AttributedModel
System.Composition.Convention
System.Composition.Hosting
System.Composition.Runtime
System.Composition.TypedParts
System.Configuration.ConfigurationManager
System.Diagnostics.EventLog
System.Diagnostics.PerformanceCounter
System.DirectoryServices.AccountManagement
System.DirectoryServices.Protocols
System.IO.Ports
System.Management
System.Runtime.Caching
System.Security.Cryptography.Xml
System.Security.Permissions
System.ServiceModel.Syndication
System.Speech
Author: eerhardt
Assignees: -
Labels:

area-Infrastructure-libraries

Milestone: -

<PropertyGroup Condition="'$(IsSourceProject)' == 'true'">
<!-- Nullability is enabled by default for all src projects. -->
<PropertyGroup Condition="'$(IsSourceProject)' == 'true' or '$(IsReferenceAssemblyProject)' == 'true'">
<!-- Nullability is enabled by default for all src and ref projects. -->
<Nullable Condition="'$(Nullable)' == ''">enable</Nullable>
Copy link
Member

Choose a reason for hiding this comment

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

Do we only want to set this property if it isn't yet set? Why not set it unconditionally? What if another component like the SDK or Arcade sets that property in the future and with that overrides our setting?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't really imagine the SDK or Arcade changing the default from blank to anything other than enable in the future. But even if they did, they still could override our setting if they were imported after this file.

In general, I prefer not unconditionally setting properties in props/targets files. If someone explicitly gets imported before this props file, and sets the value, I don't think defaulting the value should override that.

Copy link
Member

Choose a reason for hiding this comment

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

I usually unconditionally overwrite properties / items if I want to set a (new) default regardless of what was previously set. In this case it sounds like we want to set our own default. That said, I don't have a strong opinion, so I'm fine leaving it as is if you prefer that.

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

LGTM except for the few questions. Thanks Eric

@eerhardt
Copy link
Member Author

runtime-dev-innerloop (Build OSX x64 release Runtime_Debug) timing out is unrelated to this change.

Merging.

@eerhardt eerhardt merged commit 18be907 into dotnet:main Apr 25, 2022
@eerhardt eerhardt deleted the NullableEnable branch April 25, 2022 16:15
@ghost ghost locked as resolved and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants