Remove all use of <Nullable>annotations</Nullable> (#90401)
authorStephen Toub <stoub@microsoft.com>
Sat, 12 Aug 2023 03:41:47 +0000 (23:41 -0400)
committerGitHub <noreply@github.com>
Sat, 12 Aug 2023 03:41:47 +0000 (23:41 -0400)
commit616f758160b388363cdcb93e944bda443e206c84
treeae62e75372fc938901b2e246fd11ec8ab72a38d2
parent7325cc4ca1cc288263ea9c4426c97e3b22194940
Remove all use of <Nullable>annotations</Nullable> (#90401)

* Remove all use of <Nullable>annotations</Nullable>

We've inadvertently shipped multiple libraries with incorrect nullable reference type annotations because:
a) Their ref assemblies aren't actually being shipped, and/or
b) Their src projects using `<Nullable>annotations</Nullable>`

`<Nullable>annotations</Nullable>` means "I'm nullable annotated but don't validate them", which means consumers of these libraries see annotations that we haven't thoughtfully added or reviewed.

This removes all use of it and gets us back to a place where we're only shipping nullable annotations for libraries where we've done the work to ensure they're correct.  We can subsequently finish annotating these stragglers.

* Don't disable LibraryImportGenerator when nullable is disabled

* Add #nullable enable to LibraryImportAttribute file for polyfill scenarios.

* Disable LibraryImportGenerator on ILCompiler.TypeSystem.Tests assemblies.
Convert a DllImport in HostWriter that now gets the polyfill experience.

---------

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
43 files changed:
eng/generators.targets
src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj
src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly1.csproj
src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly2.csproj
src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs
src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj
src/libraries/Microsoft.Extensions.Hosting.Systemd/src/Microsoft.Extensions.Hosting.Systemd.csproj
src/libraries/System.CodeDom/ref/System.CodeDom.csproj
src/libraries/System.CodeDom/src/System.CodeDom.csproj
src/libraries/System.ComponentModel.Composition.Registration/ref/System.ComponentModel.Composition.Registration.csproj
src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj
src/libraries/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj
src/libraries/System.Composition.Convention/src/System.Composition.Convention.csproj
src/libraries/System.Composition.Hosting/src/System.Composition.Hosting.csproj
src/libraries/System.Composition.Runtime/src/System.Composition.Runtime.csproj
src/libraries/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj
src/libraries/System.Composition/src/System.Composition.csproj
src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj
src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj
src/libraries/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.csproj
src/libraries/System.Diagnostics.EventLog/src/Messages/System.Diagnostics.EventLog.Messages.csproj
src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj
src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj
src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj
src/libraries/System.DirectoryServices.AccountManagement/ref/System.DirectoryServices.AccountManagement.csproj
src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.csproj
src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj
src/libraries/System.IO.Ports/ref/System.IO.Ports.csproj
src/libraries/System.IO.Ports/src/System.IO.Ports.csproj
src/libraries/System.Management/ref/System.Management.csproj
src/libraries/System.Management/src/System.Management.csproj
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/LibraryImportAttribute.cs
src/libraries/System.Runtime.Caching/ref/System.Runtime.Caching.csproj
src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj
src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj
src/libraries/System.Security.Permissions/ref/System.Security.Permissions.csproj
src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj
src/libraries/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.csproj
src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj
src/libraries/System.Speech/ref/System.Speech.csproj
src/libraries/System.Speech/src/System.Speech.csproj
src/tests/Interop/ICastable/ICastable.CoreLib.csproj