From cff2ecd3dc90b1161291228352cd305e363cc3bb Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Fri, 11 Aug 2023 11:23:56 -0400 Subject: [PATCH 1/4] Remove all use of annotations 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 `annotations` `annotations` 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. --- .../ref/Microsoft.Extensions.Hosting.Systemd.csproj | 4 ++++ .../src/Microsoft.Extensions.Hosting.Systemd.csproj | 5 ++++- src/libraries/System.CodeDom/ref/System.CodeDom.csproj | 5 ++++- src/libraries/System.CodeDom/src/System.CodeDom.csproj | 7 +++++-- .../System.ComponentModel.Composition.Registration.csproj | 5 ++++- .../System.ComponentModel.Composition.Registration.csproj | 6 ++++-- .../src/System.Composition.AttributedModel.csproj | 6 ++++-- .../src/System.Composition.Convention.csproj | 6 ++++-- .../src/System.Composition.Hosting.csproj | 6 ++++-- .../src/System.Composition.Runtime.csproj | 6 ++++-- .../src/System.Composition.TypedParts.csproj | 6 ++++-- .../System.Composition/src/System.Composition.csproj | 5 ++++- .../ref/System.Configuration.ConfigurationManager.csproj | 7 +++++-- .../src/System.Configuration.ConfigurationManager.csproj | 7 +++++-- .../ref/System.Diagnostics.EventLog.csproj | 3 +++ .../Messages/System.Diagnostics.EventLog.Messages.csproj | 3 +-- .../src/System.Diagnostics.EventLog.csproj | 5 ++++- .../ref/System.Diagnostics.PerformanceCounter.csproj | 5 ++++- .../src/System.Diagnostics.PerformanceCounter.csproj | 5 ++++- .../ref/System.DirectoryServices.AccountManagement.csproj | 5 ++++- .../src/System.DirectoryServices.AccountManagement.csproj | 5 ++++- .../ref/System.DirectoryServices.Protocols.csproj | 6 +++++- .../src/System.DirectoryServices.Protocols.csproj | 5 ++++- src/libraries/System.IO.Ports/ref/System.IO.Ports.csproj | 6 +++++- src/libraries/System.IO.Ports/src/System.IO.Ports.csproj | 5 ++++- .../System.Management/ref/System.Management.csproj | 5 ++++- .../System.Management/src/System.Management.csproj | 5 ++++- .../ref/System.Runtime.Caching.csproj | 6 +++++- .../src/System.Runtime.Caching.csproj | 5 ++++- .../tests/System.Security.Cryptography.Xml.Tests.csproj | 2 +- .../ref/System.Security.Permissions.csproj | 7 +++++-- .../src/System.Security.Permissions.csproj | 6 ++++-- .../ref/System.ServiceModel.Syndication.csproj | 5 ++++- .../src/System.ServiceModel.Syndication.csproj | 6 ++++-- src/libraries/System.Speech/ref/System.Speech.csproj | 6 +++++- src/libraries/System.Speech/src/System.Speech.csproj | 5 ++++- src/tests/Interop/ICastable/ICastable.CoreLib.csproj | 3 ++- 37 files changed, 147 insertions(+), 48 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj b/src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj index b1ebd0e0e52e6..c5b6c8cf8fe39 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj @@ -3,6 +3,10 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1 true + + + disable + $(NoWarn);nullable diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/Microsoft.Extensions.Hosting.Systemd.csproj b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/Microsoft.Extensions.Hosting.Systemd.csproj index 0cde5d1ed3c04..9e7560103aaf4 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/Microsoft.Extensions.Hosting.Systemd.csproj +++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/Microsoft.Extensions.Hosting.Systemd.csproj @@ -6,7 +6,10 @@ true true .NET hosting infrastructure for Systemd Services. - annotations + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.CodeDom/ref/System.CodeDom.csproj b/src/libraries/System.CodeDom/ref/System.CodeDom.csproj index 3092d48e7ced0..c64f55c7b9615 100644 --- a/src/libraries/System.CodeDom/ref/System.CodeDom.csproj +++ b/src/libraries/System.CodeDom/ref/System.CodeDom.csproj @@ -1,11 +1,14 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) + + disable + $(NoWarn);nullable - \ No newline at end of file + diff --git a/src/libraries/System.CodeDom/src/System.CodeDom.csproj b/src/libraries/System.CodeDom/src/System.CodeDom.csproj index b8b2242581780..2101cb476e815 100644 --- a/src/libraries/System.CodeDom/src/System.CodeDom.csproj +++ b/src/libraries/System.CodeDom/src/System.CodeDom.csproj @@ -3,7 +3,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) true $(DefineConstants);CODEDOM - annotations false true Provides types that can be used to model the structure of a source code document and to output source code for that model in a supported language. @@ -13,6 +12,10 @@ System.CodeDom.CodeObject System.CodeDom.Compiler.CodeDomProvider Microsoft.CSharp.CSharpCodeProvider Microsoft.VisualBasic.VBCodeProvider + + + disable + $(NoWarn);nullable @@ -141,4 +144,4 @@ Microsoft.VisualBasic.VBCodeProvider - \ No newline at end of file + diff --git a/src/libraries/System.ComponentModel.Composition.Registration/ref/System.ComponentModel.Composition.Registration.csproj b/src/libraries/System.ComponentModel.Composition.Registration/ref/System.ComponentModel.Composition.Registration.csproj index 06d4e21a02ae7..1179a810cc8f3 100644 --- a/src/libraries/System.ComponentModel.Composition.Registration/ref/System.ComponentModel.Composition.Registration.csproj +++ b/src/libraries/System.ComponentModel.Composition.Registration/ref/System.ComponentModel.Composition.Registration.csproj @@ -1,7 +1,10 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1 + + disable + $(NoWarn);nullable @@ -12,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj b/src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj index cb33093b7eaf9..b8ae87f03d00b 100644 --- a/src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj +++ b/src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj @@ -1,8 +1,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1 - disable - $(NoWarn);nullable false true true @@ -16,6 +14,10 @@ System.ComponentModel.Composition.Registration.PartBuilder<T> System.ComponentModel.Composition.Registration.ParameterImportBuilder System.ComponentModel.Composition.Registration.ImportBuilder System.ComponentModel.Composition.Registration.ExportBuilder + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj b/src/libraries/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj index 7b86510beb219..15dcdee34d190 100644 --- a/src/libraries/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj +++ b/src/libraries/System.Composition.AttributedModel/src/System.Composition.AttributedModel.csproj @@ -1,8 +1,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable - $(NoWarn);nullable Microsoft true Provides common attributes used by System.Composition types. @@ -11,6 +9,10 @@ Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.AttributedModelProvider + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Composition.Convention/src/System.Composition.Convention.csproj b/src/libraries/System.Composition.Convention/src/System.Composition.Convention.csproj index 465694a414956..67d2226a982fb 100644 --- a/src/libraries/System.Composition.Convention/src/System.Composition.Convention.csproj +++ b/src/libraries/System.Composition.Convention/src/System.Composition.Convention.csproj @@ -1,8 +1,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable - $(NoWarn);nullable false Microsoft true @@ -14,6 +12,10 @@ System.Composition.Convention.ExportConventionBuilder System.Composition.Convention.ImportConventionBuilder System.Composition.Convention.PartConventionBuilder System.Composition.Convention.ParameterImportConventionBuilder + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Composition.Hosting/src/System.Composition.Hosting.csproj b/src/libraries/System.Composition.Hosting/src/System.Composition.Hosting.csproj index 03dff496a9de0..8f935f2b9f789 100644 --- a/src/libraries/System.Composition.Hosting/src/System.Composition.Hosting.csproj +++ b/src/libraries/System.Composition.Hosting/src/System.Composition.Hosting.csproj @@ -1,8 +1,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable - $(NoWarn);nullable false false Microsoft @@ -11,6 +9,10 @@ Commonly Used Types: System.Composition.Hosting.CompositionHost + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Composition.Runtime/src/System.Composition.Runtime.csproj b/src/libraries/System.Composition.Runtime/src/System.Composition.Runtime.csproj index 54202a174edde..c989745399ae0 100644 --- a/src/libraries/System.Composition.Runtime/src/System.Composition.Runtime.csproj +++ b/src/libraries/System.Composition.Runtime/src/System.Composition.Runtime.csproj @@ -2,8 +2,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) System.Composition - disable - $(NoWarn);nullable false Microsoft true @@ -11,6 +9,10 @@ Commonly Used Types: System.Composition.CompositionContext + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj b/src/libraries/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj index ad07cb8373fe4..5158f489581a5 100644 --- a/src/libraries/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj +++ b/src/libraries/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj @@ -2,8 +2,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) System.Composition - disable - $(NoWarn);nullable false false Microsoft @@ -13,6 +11,10 @@ Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Composition/src/System.Composition.csproj b/src/libraries/System.Composition/src/System.Composition.csproj index 02265175befe3..9871c89029722 100644 --- a/src/libraries/System.Composition/src/System.Composition.csproj +++ b/src/libraries/System.Composition/src/System.Composition.csproj @@ -1,7 +1,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable true Microsoft @@ -17,6 +16,10 @@ System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj index cdd04d9ab8a1d..3c894f8cfd418 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj +++ b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj @@ -1,9 +1,12 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable $(NoWarn);CS0618 true + + + disable + $(NoWarn);nullable @@ -21,4 +24,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj b/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj index 436c9ed08b465..fbed89bbb1994 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj @@ -1,14 +1,17 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable - $(NoWarn);CA2249;nullable + $(NoWarn);CA2249 false false true true Provides types that support using XML configuration files (app.config). This package exists only to support migrating existing .NET Framework code that already uses System.Configuration. When writing new code, use another configuration system instead, such as Microsoft.Extensions.Configuration. + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.csproj b/src/libraries/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.csproj index a79a4301896c4..9f8931ebfeab3 100644 --- a/src/libraries/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.csproj +++ b/src/libraries/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.csproj @@ -1,7 +1,10 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Diagnostics.EventLog/src/Messages/System.Diagnostics.EventLog.Messages.csproj b/src/libraries/System.Diagnostics.EventLog/src/Messages/System.Diagnostics.EventLog.Messages.csproj index 6949c5c5645ea..9285c392347b9 100644 --- a/src/libraries/System.Diagnostics.EventLog/src/Messages/System.Diagnostics.EventLog.Messages.csproj +++ b/src/libraries/System.Diagnostics.EventLog/src/Messages/System.Diagnostics.EventLog.Messages.csproj @@ -1,8 +1,7 @@ netstandard2.0 - - + disable EventLogMessages.res diff --git a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj index 99e2ad2c660ab..96deaca0a27dd 100644 --- a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj +++ b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj @@ -2,12 +2,15 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) true - annotations true Provides the System.Diagnostics.EventLog class, which allows the applications to use the Windows event log service. Commonly Used Types: System.Diagnostics.EventLog + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj b/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj index bd54c56e42796..3b30e8f214e9b 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj +++ b/src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj @@ -1,8 +1,11 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable true + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj b/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj index abda27a9d2088..8f8c2613c2061 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj +++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj @@ -2,12 +2,15 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) true - annotations true Provides the System.Diagnostics.PerformanceCounter class, which allows access to Windows performance counters. Commonly Used Types: System.Diagnostics.PerformanceCounter + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.DirectoryServices.AccountManagement/ref/System.DirectoryServices.AccountManagement.csproj b/src/libraries/System.DirectoryServices.AccountManagement/ref/System.DirectoryServices.AccountManagement.csproj index b1b8d3d9f3425..d80091c22c402 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/ref/System.DirectoryServices.AccountManagement.csproj +++ b/src/libraries/System.DirectoryServices.AccountManagement/ref/System.DirectoryServices.AccountManagement.csproj @@ -1,7 +1,10 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0 + + disable + $(NoWarn);nullable @@ -11,4 +14,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj b/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj index 538c7aeac0b0e..31119b2842512 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj +++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj @@ -5,12 +5,15 @@ true $(NoWarn);CA2249 $(NoWarn);IDE0059;IDE0060;CA1822;CA1859 - annotations false true true true Provides uniform access and manipulation of user, computer, and group security principals across the multiple principal stores: Active Directory Domain Services (AD DS), Active Directory Lightweight Directory Services (AD LDS), and Machine SAM (MSAM). + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.csproj b/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.csproj index 986c74c8712b2..2524d7e16a497 100644 --- a/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.csproj +++ b/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.csproj @@ -1,6 +1,10 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0 + + + disable + $(NoWarn);nullable @@ -10,4 +14,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj index da521e6ac1944..cfcab2e34245e 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj +++ b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj @@ -4,13 +4,16 @@ true true true - annotations true true Provides the methods defined in the Lightweight Directory Access Protocol (LDAP) version 3 (V3) and Directory Services Markup Language (DSML) version 2.0 (V2) standards. $(NoWarn);CS3016 false + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.IO.Ports/ref/System.IO.Ports.csproj b/src/libraries/System.IO.Ports/ref/System.IO.Ports.csproj index ddd6cbb72923f..666a076ae3a97 100644 --- a/src/libraries/System.IO.Ports/ref/System.IO.Ports.csproj +++ b/src/libraries/System.IO.Ports/ref/System.IO.Ports.csproj @@ -1,10 +1,14 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) + + + disable + $(NoWarn);nullable - \ No newline at end of file + diff --git a/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj b/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj index 958fd6b49b836..3cae36d8a4cd4 100644 --- a/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj +++ b/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj @@ -4,12 +4,15 @@ true $(DefineConstants);SERIAL_PORTS true - annotations true Provides classes for controlling serial ports. Commonly Used Types: System.IO.Ports.SerialPort + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Management/ref/System.Management.csproj b/src/libraries/System.Management/ref/System.Management.csproj index 6470e210a1908..c7b1fb60438ca 100644 --- a/src/libraries/System.Management/ref/System.Management.csproj +++ b/src/libraries/System.Management/ref/System.Management.csproj @@ -1,7 +1,10 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0 + + disable + $(NoWarn);nullable @@ -12,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Management/src/System.Management.csproj b/src/libraries/System.Management/src/System.Management.csproj index 88bb095f34894..d07fdf39c2d0a 100644 --- a/src/libraries/System.Management/src/System.Management.csproj +++ b/src/libraries/System.Management/src/System.Management.csproj @@ -4,7 +4,6 @@ true $(NoWarn);0618 $(NoWarn);IDE0059;IDE0060;CA1822 - annotations true true true @@ -15,6 +14,10 @@ Commonly Used Types: System.Management.ManagementClass System.Management.ManagementObject System.Management.SelectQuery + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Runtime.Caching/ref/System.Runtime.Caching.csproj b/src/libraries/System.Runtime.Caching/ref/System.Runtime.Caching.csproj index d5113b2f98197..ae5e4a2e27f7d 100644 --- a/src/libraries/System.Runtime.Caching/ref/System.Runtime.Caching.csproj +++ b/src/libraries/System.Runtime.Caching/ref/System.Runtime.Caching.csproj @@ -1,9 +1,13 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0 + + + disable + $(NoWarn);nullable - \ No newline at end of file + diff --git a/src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj b/src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj index cfc6b8128fcd4..b3d85127f0212 100644 --- a/src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj +++ b/src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj @@ -2,7 +2,6 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0 true - Annotations true true true @@ -20,6 +19,10 @@ System.Runtime.Caching.FileChangeMonitor System.Runtime.Caching.HostFileChangeMonitor System.Runtime.Caching.MemoryCache System.Runtime.Caching.ObjectCache + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj b/src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj index 57c47b0787b65..b4704975b8215 100644 --- a/src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj @@ -1,7 +1,7 @@ $(NetCoreAppCurrent);$(NetFrameworkMinimum) - annotations + disable + $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable true + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj b/src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj index c288d44efe151..0af50a00ff93b 100644 --- a/src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj +++ b/src/libraries/System.Security.Permissions/src/System.Security.Permissions.csproj @@ -2,11 +2,13 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) true - disable - $(NoWarn);nullable true Provides types supporting Code Access Security (CAS). true + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.csproj b/src/libraries/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.csproj index cd32bdff6bc81..7fae0526ada67 100644 --- a/src/libraries/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.csproj +++ b/src/libraries/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.csproj @@ -1,7 +1,10 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) + + disable + $(NoWarn);nullable @@ -13,4 +16,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj b/src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj index d1234517c51de..e076ac1da0072 100644 --- a/src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj +++ b/src/libraries/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj @@ -1,12 +1,14 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) - disable - $(NoWarn);nullable false true true Provides classes related to service model syndication. + + + disable + $(NoWarn);nullable diff --git a/src/libraries/System.Speech/ref/System.Speech.csproj b/src/libraries/System.Speech/ref/System.Speech.csproj index 469af1829fbbc..a0bfeb2716286 100644 --- a/src/libraries/System.Speech/ref/System.Speech.csproj +++ b/src/libraries/System.Speech/ref/System.Speech.csproj @@ -1,9 +1,13 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0 + + + disable + $(NoWarn);nullable - \ No newline at end of file + diff --git a/src/libraries/System.Speech/src/System.Speech.csproj b/src/libraries/System.Speech/src/System.Speech.csproj index 54065e0bbe6dc..53c3970cd0f06 100644 --- a/src/libraries/System.Speech/src/System.Speech.csproj +++ b/src/libraries/System.Speech/src/System.Speech.csproj @@ -6,7 +6,6 @@ $(NoWarn);CS0649;SA1129;IDE0059;IDE0060;CA1822;CA1852 - annotations false false @@ -18,6 +17,10 @@ Commonly Used Types System.Speech.Synthesis.SpeechSynthesizer System.Speech.Recognition.SpeechRecognizer + + + disable + $(NoWarn);nullable diff --git a/src/tests/Interop/ICastable/ICastable.CoreLib.csproj b/src/tests/Interop/ICastable/ICastable.CoreLib.csproj index 482a08e0f78ca..cb2bd33fb5d74 100644 --- a/src/tests/Interop/ICastable/ICastable.CoreLib.csproj +++ b/src/tests/Interop/ICastable/ICastable.CoreLib.csproj @@ -9,7 +9,8 @@ Library SharedLibrary System.Private.CoreLib - annotations + disable + $(NoWarn);nullable From 1662e841248f4dc46826049db1d107b30603a431 Mon Sep 17 00:00:00 2001 From: Eric StJohn Date: Fri, 11 Aug 2023 10:39:58 -0700 Subject: [PATCH 2/4] Don't disable LibraryImportGenerator when nullable is disabled --- eng/generators.targets | 4 ---- 1 file changed, 4 deletions(-) diff --git a/eng/generators.targets b/eng/generators.targets index 041a6dba8f4b6..d1e13147ed12c 100644 --- a/eng/generators.targets +++ b/eng/generators.targets @@ -3,10 +3,6 @@ true - - false From bf2a90ee1d766990417cc2d3a792b20c1e5c3b5b Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 11 Aug 2023 11:07:57 -0700 Subject: [PATCH 3/4] Add #nullable enable to LibraryImportAttribute file for polyfill scenarios. --- .../src/System/Runtime/InteropServices/LibraryImportAttribute.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/LibraryImportAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/LibraryImportAttribute.cs index 202433b2c8218..f8ef31ee41f61 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/LibraryImportAttribute.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/LibraryImportAttribute.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#nullable enable namespace System.Runtime.InteropServices { From f81be631d0a897a982d565de279c3e405d31b325 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 11 Aug 2023 11:36:04 -0700 Subject: [PATCH 4/4] Disable LibraryImportGenerator on ILCompiler.TypeSystem.Tests assemblies. Convert a DllImport in HostWriter that now gets the polyfill experience. --- .../CoreTestAssembly/CoreTestAssembly.csproj | 4 +++- .../TypeEquivalenceAssembly/TypeEquivalenceAssembly1.csproj | 4 +++- .../TypeEquivalenceAssembly/TypeEquivalenceAssembly2.csproj | 4 +++- .../managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj index 90a8efbc32fac..3edc005bedc6b 100644 --- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj @@ -13,5 +13,7 @@ v4.0.30319 false false + + false - \ No newline at end of file + diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly1.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly1.csproj index 36d58c2b9dceb..cba4bb4a7634a 100644 --- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly1.csproj +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly1.csproj @@ -12,6 +12,8 @@ false false TYPEEQUIVALENCEASSEMBLY_1 + + false @@ -19,4 +21,4 @@ CoreTestAssembly - \ No newline at end of file + diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly2.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly2.csproj index 01f7f4a8c599f..670278cbc8422 100644 --- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly2.csproj +++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeEquivalenceAssembly/TypeEquivalenceAssembly2.csproj @@ -12,6 +12,8 @@ false false TYPEEQUIVALENCEASSEMBLY_2 + + false @@ -19,4 +21,4 @@ CoreTestAssembly - \ No newline at end of file + diff --git a/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs b/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs index 876e9bf544c1f..b801cc4ee529d 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs @@ -15,7 +15,7 @@ namespace Microsoft.NET.HostModel.AppHost /// Embeds the App Name into the AppHost.exe /// If an apphost is a single-file bundle, updates the location of the bundle headers. /// - public static class HostWriter + public static partial class HostWriter { /// /// hash value embedded in default apphost executable in a place where the path to the app binary should be stored. @@ -232,7 +232,7 @@ void FindBundleHeader() return headerOffset != 0; } - [DllImport("libc", SetLastError = true)] - private static extern int chmod(string pathname, int mode); + [LibraryImport("libc", SetLastError = true)] + private static partial int chmod([MarshalAs(UnmanagedType.LPStr)] string pathname, int mode); } }