Skip to content

Annotate remainder of .NET Core assemblies for nullable reference types #2339

Closed

Description

In .NET Core 3.0, we annotated System.Private.CoreLib for nullable reference types, along with the reference assemblies that surface those types, and the implementations for all of the partial facades behind those reference assemblies. That represents something around 20% of the surface area. Post-.NET Core 3.0, we plan to annotate the rest.

Our desired approach to annotating an assembly is to only do so once all of its dependencies are annotated. That way, the assembly can be annotated as a unit, and barring any bugs that need to be fixed in a dependency, we won't need to spend time fixing up new warnings in higher-level assemblies as lower-level assemblies are annotated. This leads to a semi-ordering of how assemblies should be annotated, from the "bottom up". Here is a rough grouping. We can annotate everything in group 1 (in parallel if desired), then everything in group 2 (in parallel if desired), etc. There is of course more parallelism than this available, as not every assembly in group N has a dependency on every assembly in group N - 1, but the graph is complicated and this is easier to visualize and reason about.

We will:

  • Submit individual PRs, one for each assembly. Each PR should include changes to both the src and the ref. Each PR should contain only changes related to the nullable annotations/attributes, no other changes.
  • PRs can be merged once the annotations have been appropriately reviewed in PR.
  • API reviews will happen subsequently, after PRs have been merged, in batch based on everything in master.

cc: @dotnet/nullablefc, @cartermp

0 (Completed in .NET Core 3.0)

  • System.Buffers
  • System.Collections
  • System.Collections.Concurrent
  • System.Diagnostics.Contracts
  • System.Diagnostics.Debug
  • System.Diagnostics.StackTrace
  • System.Diagnostics.Tools
  • System.Diagnostics.Tracing
  • System.Memory
  • System.Numerics.Vectors
  • System.Reflection.Emit
  • System.Reflection.Emit.ILGenerator
  • System.Reflection.Emit.Lightweight
  • System.Reflection.Primitives
  • System.Resources.ResourceManager
  • System.Runtime
  • System.Runtime.Extensions
  • System.Runtime.InteropServices
  • System.Runtime.Intrinsics
  • System.Runtime.Loader
  • System.Security.Principal
  • System.Text.Encoding.Extensions
  • System.Threading
  • System.Threading.Overlapped
  • System.Threading.Tasks
  • System.Threading.Thread
  • System.Threading.ThreadPool
  • System.Threading.Timer

1

  • Microsoft.Win32.Primitives
  • System.Collections.NonGeneric
  • System.Collections.Specialized
  • System.ComponentModel
  • System.ComponentModel.Primitives
  • System.Console
  • System.Diagnostics.DiagnosticSource
  • System.Drawing.Primitives
  • System.IO.Compression
  • System.IO.Pipelines
  • System.Linq
  • System.Linq.Parallel
  • System.Net.WebHeaderCollection
  • System.ObjectModel
  • System.Reflection.DispatchProxy
  • System.Reflection.TypeExtensions
  • System.Resources.Writer
  • System.Runtime.CompilerServices.Unsafe
  • System.Runtime.CompilerServices.VisualC
  • System.Runtime.InteropServices.RuntimeInformation
  • System.Runtime.Numerics
  • System.Runtime.Serialization.Formatters
  • System.Runtime.Serialization.Primitives
  • System.Security.Cryptography.Primitives
  • System.Security.Principal
  • System.Text.Encoding.CodePages
  • System.Text.Encodings.Web
  • System.Text.Json
  • System.Text.RegularExpressions
  • System.Threading.Channels
  • System.Threading.Tasks.Parallel
  • System.Transactions.Local
  • System.Web.HttpUtility

2

  • System.Collections.Immutable
  • System.ComponentModel.EventBasedAsync
  • System.IO.Compression.Brotli
  • System.IO.FileSystem
  • System.IO.FileSystem.DriveInfo
  • System.IO.FileSystem.Watcher
  • System.IO.MemoryMappedFiles
  • System.Linq.Expressions
  • System.Reflection.Metadata
  • System.Security.Claims
  • System.Security.Cryptography.Encoding

3

  • Microsoft.Win32.SystemEvents
  • System.ComponentModel.Composition
  • System.Diagnostics.FileVersionInfo
  • System.Dynamic.Runtime
  • System.IO.Compression.ZipFile
  • System.Linq.Queryable
  • System.Reflection.MetadataLoadContext
  • System.Security.AccessControl
  • System.Security.Cryptography.Algorithms
  • System.Security.Principal.Windows

4

  • Microsoft.Win32.Registry
  • System.Diagnostics.Process
  • System.Diagnostics.TraceSource
  • System.Drawing.Common
  • System.IO.FileSystem.AccessControl
  • System.IO.IsolatedStorage
  • System.IO.Pipes
  • System.Net.Primitives
  • System.Net.WebSockets
  • System.Security.Cryptography.Cng
  • System.Security.Cryptography.Csp
  • System.Security.Cryptography.OpenSsl
  • System.Security.Cryptography.X509Certificates

5

  • Microsoft.VisualBasic.Core
  • System.IO.Pipes.AccessControl
  • System.Net.NameResolution
  • System.Net.Ping
  • System.Net.Security
  • System.Net.ServicePoint
  • System.Net.Sockets
  • System.Security.Cryptography.Pkcs

6

  • System.Net.NetworkInformation
  • System.Net.WebProxy

7

  • System.Net.Http

8

  • System.Net.Requests
  • System.Net.WebSockets.Client
  • System.Utf8String.Experimental
  • System.Runtime.WindowsRuntime
  • System.Runtime.WindowsRuntime.UI.Xaml
  • Microsoft.CSharp
  • System.Private.Xml (this and the below System.Xml.* contracts should all be done together)
  • System.Xml.ReaderWriter
  • System.Xml.XPath
  • System.Xml.XPath.XDocument
  • System.Xml.XDocument
  • System.Xml.XmlDocument
  • System.Xml.XmlSerializer

9

  • System.ComponentModel.TypeConverter (will be annotated in 6.0; in progress by @safern)
  • System.Data.Common
  • System.Data.DataSetExtensions
  • System.Diagnostics.TextWriterTraceListener
  • System.Net.HttpListener
  • System.Net.Mail
  • System.Net.WebClient
  • System.Private.DataContractSerialization
  • System.Private.Xml.Linq
  • System.Runtime.Serialization.Json
  • System.Runtime.Serialization.Xml

10 (part of netcoreapp but reference netstandard)

With netstandard not annotated, we will need to be cognizant of the fact that all dependencies will be viewed as oblivious.

  • System.ComponentModel.Annotations
  • System.Threading.Tasks.Dataflow

11 (not part of netcoreapp but reference netcoreapp)

  • System.DirectoryServices
  • System.Data.Odbc
  • System.Diagnostics.EventLog
  • System.DirectoryServices.Protocols
  • System.Security.Permissions
  • System.ServiceProcess.ServiceController
  • System.Windows.Extensions

12 (built from dotnet/runtime but not in netcoreapp and reference netstandard)

With netstandard not annotated, we will need to be cognizant of the fact that all dependencies will be viewed as oblivious:

  • Microsoft.Win32.Registry.AccessControl => netstandard
  • System.CodeDom => netstandard
  • System.ComponentModel.Composition.Registration => netstandard, System.Reflection.Context
  • System.Composition.AttributedModel => netstandard
  • System.Composition.Convention => netstandard, System.Composition.AttributedModel
  • System.Composition.Hosting => netstandard, System.Composition.Runtime
  • System.Composition.Runtime => netstandard
  • System.Composition.TypedParts => netstandard, System.Composition.Runtime, System.Composition.AttributedModel, System.Composition.Hosting
  • System.Configuration.ConfigurationManager => netstandard, System.Security.Cryptography.ProtectedData
  • System.Data.OleDb => netstandard, System.Diagnostics.PerformanceCounter, System.Configuration.ConfigurationManager
  • System.Diagnostics.PerformanceCounter => System.Configuration.ConfigurationManager
  • System.DirectoryServices.AccountManagement => System.Configuration.ConfigurationManager
  • System.IO.Packaging => netstandard
  • System.IO.Ports => netstandard
  • System.Management => System.CodeDom
  • System.Net.Http.WinHttpHandler => netstandard
  • System.Numerics.Tensors => netstandard
  • System.Reflection.Context => netstandard
  • System.Resources.Extensions => netstandard
  • System.Runtime.Caching => netstandard, System.Configuration.ConfigurationManager
  • System.Security.Cryptography.ProtectedData => netstandard
  • System.Security.Cryptography.Xml => netstandard
  • System.ServiceModel.Syndication => netstandard
  • System.Threading.AccessControl => netstandard

13

  • Remove #nullable enable from individual files after all dependent projects annotated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area-MetatrackingThis issue is tracking the completion of other related issues.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions