Remove all DLLIMPORTGENERATOR_ENABLED usage. (#61476)
authorAaron Robinson <arobins@microsoft.com>
Fri, 12 Nov 2021 19:08:39 +0000 (11:08 -0800)
committerGitHub <noreply@github.com>
Fri, 12 Nov 2021 19:08:39 +0000 (11:08 -0800)
* Remove all DLLIMPORTGENERATOR_ENABLED usage.

* Explicitly set EnableDllImportGenerator to true in test project.

36 files changed:
eng/generators.targets
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptAcquireContext.cs
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyHash.cs
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyKey.cs
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetProvParam.cs
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptReleaseContext.cs
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EncryptDecrypt.cs
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.OpenProcessToken_SafeAccessTokenHandle.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertCloseStore.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertDuplicateCertificateContext.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertEnumCertificatesInStore.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertFreeCertificateContext.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertNameToStr.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgClose.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgGetParam.cs
src/libraries/Common/src/Interop/Windows/Crypt32/Interop.certificates.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateFile.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetConsoleCtrlHandler.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs
src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Properties.cs
src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp.cs
src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj
src/libraries/System.IO.Ports/src/System.IO.Ports.csproj
src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj
src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj
src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/Microsoft.Interop.DllImportGenerator.props
src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj
src/libraries/System.Windows.Extensions/src/System.Windows.Extensions.csproj

index 53a0286..bcedd85 100644 (file)
@@ -3,7 +3,6 @@
   <PropertyGroup>
     <EnableDllImportGenerator Condition="'$(EnableDllImportGenerator)' == ''
                         and '$(MSBuildProjectName)' == 'System.Private.CoreLib'">true</EnableDllImportGenerator>
-    <SetDllImportGeneratorConstants>false</SetDllImportGeneratorConstants>
     <IncludeDllImportGeneratorSources Condition="'$(IncludeDllImportGeneratorSources)' == ''">true</IncludeDllImportGeneratorSources>
   </PropertyGroup>
   <ItemGroup>
index d45b7e1..bffdc20 100644 (file)
@@ -20,13 +20,8 @@ internal static partial class Interop
             CRYPT_VERIFYCONTEXT = 0xF0000000      // CRYPT_VERIFYCONTEXT
         }
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CryptAcquireContextW", CharSet = CharSet.Unicode, SetLastError = true)]
         public static partial bool CryptAcquireContext(
-#else
-        [DllImport(Libraries.Advapi32, EntryPoint = "CryptAcquireContextW", CharSet = CharSet.Unicode, SetLastError = true)]
-        public static extern bool CryptAcquireContext(
-#endif
             out SafeProvHandle phProv,
             string? szContainer,
             string? szProvider,
index 8635ce3..5c2b78f 100644 (file)
@@ -8,12 +8,7 @@ internal static partial class Interop
 {
     internal static partial class Advapi32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
         public static partial bool CryptDestroyHash(IntPtr hHash);
-#else
-        [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
-        public static extern bool CryptDestroyHash(IntPtr hHash);
-#endif
     }
 }
index 5bc36fb..0707494 100644 (file)
@@ -8,12 +8,7 @@ internal static partial class Interop
 {
     internal static partial class Advapi32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
         public static partial bool CryptDestroyKey(IntPtr hKey);
-#else
-        [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
-        public static extern bool CryptDestroyKey(IntPtr hKey);
-#endif
     }
 }
index d5a6b6d..bacf09e 100644 (file)
@@ -22,37 +22,22 @@ internal static partial class Interop
             PP_UNIQUE_CONTAINER = 36
         }
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
         public static partial bool CryptSetProvParam(
-#else
-        [DllImport(Libraries.Advapi32, SetLastError = true)]
-        public static extern bool CryptSetProvParam(
-#endif
             SafeHandle safeProvHandle,
             CryptProvParam dwParam,
             IntPtr pbData,
             int dwFlags);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
         public static partial bool CryptSetProvParam(
-#else
-        [DllImport(Libraries.Advapi32, SetLastError = true)]
-        public static extern bool CryptSetProvParam(
-#endif
             SafeProvHandle hProv,
             CryptProvParam dwParam,
             ref IntPtr pbData,
             int dwFlags);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
         public static partial bool CryptGetProvParam(
-#else
-        [DllImport(Libraries.Advapi32, SetLastError = true)]
-        public static extern bool CryptGetProvParam(
-#endif
             SafeHandle safeProvHandle,
             CryptProvParam dwParam,
             IntPtr pbData,
index f36800f..30c806a 100644 (file)
@@ -8,13 +8,8 @@ internal static partial class Interop
 {
     internal static partial class Advapi32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
         public static partial bool CryptReleaseContext(
-#else
-        [DllImport(Libraries.Advapi32, SetLastError = true)]
-        public static extern bool CryptReleaseContext(
-#endif
             IntPtr hProv,
             int dwFlags);
     }
index 659fbe3..2b60007 100644 (file)
@@ -11,13 +11,8 @@ internal static partial class Interop
         /// <summary>
         /// WARNING: This method does not implicitly handle long paths. Use EncryptFile.
         /// </summary>
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "EncryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
         private static partial bool EncryptFilePrivate(string lpFileName);
-#else
-        [DllImport(Libraries.Advapi32, EntryPoint = "EncryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
-        private static extern bool EncryptFilePrivate(string lpFileName);
-#endif
 
         internal static bool EncryptFile(string path)
         {
@@ -28,13 +23,8 @@ internal static partial class Interop
         /// <summary>
         /// WARNING: This method does not implicitly handle long paths. Use DecryptFile.
         /// </summary>
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "DecryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
         private static partial bool DecryptFileFilePrivate(
-#else
-        [DllImport(Libraries.Advapi32, EntryPoint = "DecryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
-        private static extern bool DecryptFileFilePrivate(
-#endif
             string lpFileName,
             int dwReserved);
 
index bf48ccb..3d47f27 100644 (file)
@@ -10,13 +10,8 @@ internal static partial class Interop
 {
     internal static partial class Advapi32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.Advapi32, SetLastError = true)]
         internal static partial bool OpenProcessToken(
-#else
-        [DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
-        internal static extern bool OpenProcessToken(
-#endif
             IntPtr ProcessToken,
             TokenAccessLevels DesiredAccess,
             out SafeAccessTokenHandle TokenHandle);
index f26df2d..abecccc 100644 (file)
@@ -8,12 +8,7 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         internal static partial bool CertCloseStore(IntPtr hCertStore, uint dwFlags);
-#else
-        [DllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern bool CertCloseStore(IntPtr hCertStore, uint dwFlags);
-#endif
     }
 }
index 3ebbb87..e87fbd6 100644 (file)
@@ -9,12 +9,7 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         internal static partial SafeCertContextHandle CertDuplicateCertificateContext(IntPtr pCertContext);
-#else
-        [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern SafeCertContextHandle CertDuplicateCertificateContext(IntPtr pCertContext);
-#endif
     }
 }
index 50cb6c5..be2172e 100644 (file)
@@ -8,13 +8,8 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         public static unsafe partial CERT_CONTEXT* CertEnumCertificatesInStore(
-#else
-        [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        public static unsafe extern CERT_CONTEXT* CertEnumCertificatesInStore(
-#endif
             IntPtr hCertStore,
             CERT_CONTEXT* pPrevCertContext);
     }
index 9158b59..11ad3eb 100644 (file)
@@ -9,12 +9,7 @@ internal static partial class Interop
     internal static partial class Crypt32
     {
         // Note: This api always return TRUE, regardless of success.
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         internal static partial bool CertFreeCertificateContext(IntPtr pCertContext);
-#else
-        [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern bool CertFreeCertificateContext(IntPtr pCertContext);
-#endif
     }
 }
index fbc2a15..a6a2001 100644 (file)
@@ -9,8 +9,6 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
-
         [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         internal static partial bool CertGetCertificateContextProperty(
             SafeCertContextHandle pCertContext,
@@ -31,30 +29,5 @@ internal static partial class Interop
             CertContextPropId dwPropId,
             out DATA_BLOB pvData,
             ref int pcbData);
-
-#else
-
-        [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern bool CertGetCertificateContextProperty(
-            SafeCertContextHandle pCertContext,
-            CertContextPropId dwPropId,
-            [Out] byte[]? pvData,
-            [In, Out] ref int pcbData);
-
-        [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern bool CertGetCertificateContextProperty(
-            SafeCertContextHandle pCertContext,
-            CertContextPropId dwPropId,
-            out IntPtr pvData,
-            [In, Out] ref int pcbData);
-
-        [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern bool CertGetCertificateContextProperty(
-            SafeCertContextHandle pCertContext,
-            CertContextPropId dwPropId,
-            [Out] out DATA_BLOB pvData,
-            [In, Out] ref int pcbData);
-
-#endif
     }
 }
index 5f8c59d..545cbe6 100644 (file)
@@ -8,20 +8,11 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         internal static partial bool CertGetCertificateContextProperty(
             SafeCertContextHandle pCertContext,
             CertContextPropId dwPropId,
             byte[] pvData,
             ref int pcbData);
-#else
-        [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern bool CertGetCertificateContextProperty(
-            SafeCertContextHandle pCertContext,
-            CertContextPropId dwPropId,
-            [Out] byte[] pvData,
-            [In, Out] ref int pcbData);
-#endif
     }
 }
index 534dc64..0228f4b 100644 (file)
@@ -7,13 +7,8 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, EntryPoint = "CertNameToStrW", CharSet = CharSet.Unicode, SetLastError = true)]
         internal static unsafe partial int CertNameToStr(
-#else
-        [DllImport(Libraries.Crypt32, EntryPoint = "CertNameToStrW", CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern unsafe int CertNameToStr(
-#endif
             int dwCertEncodingType,
             void* pName,
             int dwStrType,
index f4235e3..03b528c 100644 (file)
@@ -8,12 +8,7 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         internal static partial bool CryptMsgClose(IntPtr hCryptMsg);
-#else
-        [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        internal static extern bool CryptMsgClose(IntPtr hCryptMsg);
-#endif
     }
 }
index 8795a15..a16ef67 100644 (file)
@@ -9,52 +9,32 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
         internal static partial bool CryptMsgGetParam(
-#else
-        [DllImport(Libraries.Crypt32, SetLastError = true)]
-        internal static extern bool CryptMsgGetParam(
-#endif
             SafeCryptMsgHandle hCryptMsg,
             CryptMsgParamType dwParamType,
             int dwIndex,
             out int pvData,
             ref int pcbData);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
         internal static unsafe partial bool CryptMsgGetParam(
-#else
-        [DllImport(Libraries.Crypt32, SetLastError = true)]
-        internal static unsafe extern bool CryptMsgGetParam(
-#endif
             SafeCryptMsgHandle hCryptMsg,
             CryptMsgParamType dwParamType,
             int dwIndex,
             byte* pvData,
             ref int pcbData);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
         internal static partial bool CryptMsgGetParam(
-#else
-        [DllImport(Libraries.Crypt32, SetLastError = true)]
-        internal static extern bool CryptMsgGetParam(
-#endif
             SafeCryptMsgHandle hCryptMsg,
             CryptMsgParamType dwParamType,
             int dwIndex,
             out CryptMsgType pvData,
             ref int pcbData);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
         internal static partial bool CryptMsgGetParam(
-#else
-        [DllImport(Libraries.Crypt32, SetLastError = true)]
-        internal static extern bool CryptMsgGetParam(
-#endif
             SafeCryptMsgHandle hCryptMsg,
             CryptMsgParamType dwParamType,
             int dwIndex,
index e61361b..6487086 100644 (file)
@@ -10,25 +10,13 @@ internal static partial class Interop
 {
     internal static partial class Crypt32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         internal static partial bool CertFreeCertificateContext(IntPtr pCertContext);
-#else
-        [DllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        internal static extern bool CertFreeCertificateContext(IntPtr pCertContext);
-#endif
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         internal static partial bool CertVerifyCertificateChainPolicy(
-#else
-        [DllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        internal static extern bool CertVerifyCertificateChainPolicy(
-#endif
             IntPtr pszPolicyOID,
             SafeX509ChainHandle pChainContext,
             ref CERT_CHAIN_POLICY_PARA pPolicyPara,
index f26661c..b62016d 100644 (file)
@@ -13,13 +13,8 @@ internal static partial class Interop
         /// <summary>
         /// WARNING: This method does not implicitly handle long paths. Use CreateFile.
         /// </summary>
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
         private static unsafe partial SafeFileHandle CreateFilePrivate(
-#else
-        [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
-        private static unsafe extern SafeFileHandle CreateFilePrivate(
-#endif
             string lpFileName,
             int dwDesiredAccess,
             FileShare dwShareMode,
index 9b0e857..689e443 100644 (file)
@@ -7,14 +7,8 @@ internal static partial class Interop
 {
     internal static partial class Kernel32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         internal static partial bool FlushFileBuffers(SafeHandle hHandle);
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        internal static extern bool FlushFileBuffers(SafeHandle hHandle);
-#endif
     }
 }
index b03d88f..6eb46b1 100644 (file)
@@ -8,13 +8,8 @@ internal static partial class Interop
 {
     internal static partial class Kernel32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static partial bool GetConsoleMode(IntPtr handle, out int mode);
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern bool GetConsoleMode(IntPtr handle, out int mode);
-#endif
 
         internal static bool IsGetConsoleModeCallSuccessful(IntPtr handle)
         {
@@ -22,13 +17,8 @@ internal static partial class Interop
             return GetConsoleMode(handle, out mode);
         }
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static partial bool SetConsoleMode(IntPtr handle, int mode);
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern bool SetConsoleMode(IntPtr handle, int mode);
-#endif
 
         internal const int ENABLE_PROCESSED_INPUT = 0x0001;
         internal const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004;
index d5d2062..76f99ac 100644 (file)
@@ -7,12 +7,7 @@ internal static partial class Interop
 {
     internal static partial class Kernel32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static partial int GetFileType(SafeHandle hFile);
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern int GetFileType(SafeHandle hFile);
-#endif
     }
 }
index 9651a10..00b66c4 100644 (file)
@@ -8,13 +8,8 @@ internal static partial class Interop
 {
     internal static partial class Kernel32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static unsafe partial int ReadFile(
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern unsafe int ReadFile(
-#endif
             SafeHandle handle,
             byte* bytes,
             int numBytesToRead,
index ba9b6a9..ceebb11 100644 (file)
@@ -9,26 +9,16 @@ internal static partial class Interop
 {
     internal static partial class Kernel32
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static unsafe partial int ReadFile(
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern unsafe int ReadFile(
-#endif
             SafeHandle handle,
             byte* bytes,
             int numBytesToRead,
             IntPtr numBytesRead_mustBeZero,
             NativeOverlapped* overlapped);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static unsafe partial int ReadFile(
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern unsafe int ReadFile(
-#endif
             SafeHandle handle,
             byte* bytes,
             int numBytesToRead,
index 8a64d27..27c62e0 100644 (file)
@@ -13,12 +13,7 @@ internal static partial class Interop
         internal const int CTRL_LOGOFF_EVENT = 5;
         internal const int CTRL_SHUTDOWN_EVENT = 6;
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static unsafe partial bool SetConsoleCtrlHandler(delegate* unmanaged<int, BOOL> handler, bool Add);
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern unsafe bool SetConsoleCtrlHandler(delegate* unmanaged<int, BOOL> HandlerRoutine, bool Add);
-#endif
     }
 }
index 6354c1a..0e7cc88 100644 (file)
@@ -15,13 +15,8 @@ internal static partial class Interop
         // struct in a callback (or an EndWrite method called by that callback),
         // and pass in an address for the numBytesRead parameter.
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static unsafe partial int WriteFile(
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern unsafe int WriteFile(
-#endif
             SafeHandle handle,
             byte* bytes,
             int numBytesToWrite,
index 0f66079..3ae10aa 100644 (file)
@@ -15,26 +15,16 @@ internal static partial class Interop
         // simultaneously: overlapped IO, free the memory for the overlapped
         // struct in a callback (or an EndWrite method called by that callback),
         // and pass in an address for the numBytesRead parameter.
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static unsafe partial int WriteFile(
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern unsafe int WriteFile(
-#endif
             SafeHandle handle,
             byte* bytes,
             int numBytesToWrite,
             IntPtr numBytesWritten_mustBeZero,
             NativeOverlapped* lpOverlapped);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
         internal static unsafe partial int WriteFile(
-#else
-        [DllImport(Libraries.Kernel32, SetLastError = true)]
-        internal static extern unsafe int WriteFile(
-#endif
             SafeHandle handle,
             byte* bytes,
             int numBytesToWrite,
index 4304ccf..d160b1a 100644 (file)
@@ -13,13 +13,8 @@ internal static partial class Interop
 {
     internal static partial class NCrypt
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
         internal static unsafe partial ErrorCode NCryptGetProperty(
-#else
-        [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
-        internal static extern unsafe ErrorCode NCryptGetProperty(
-#endif
             SafeNCryptHandle hObject,
             string pszProperty,
             void* pbOutput,
@@ -27,13 +22,8 @@ internal static partial class Interop
             out int pcbResult,
             CngPropertyOptions dwFlags);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
         internal static unsafe partial ErrorCode NCryptSetProperty(
-#else
-        [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
-        internal static extern unsafe ErrorCode NCryptSetProperty(
-#endif
             SafeNCryptHandle hObject,
             string pszProperty,
             void* pbInput,
index c09f70b..85ca830 100644 (file)
@@ -9,48 +9,27 @@ internal static partial class Interop
 {
     internal static partial class WinHttp
     {
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         public static partial SafeWinHttpHandle WinHttpOpen(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        public static extern SafeWinHttpHandle WinHttpOpen(
-#endif
             IntPtr userAgent,
             uint accessType,
             string? proxyName,
             string? proxyBypass, int flags);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpCloseHandle(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpCloseHandle(
-#endif
             IntPtr handle);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         public static partial SafeWinHttpHandle WinHttpConnect(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        public static extern SafeWinHttpHandle WinHttpConnect(
-#endif
             SafeWinHttpHandle sessionHandle,
             string serverName,
             ushort serverPort,
             uint reserved);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         public static partial SafeWinHttpHandle WinHttpOpenRequest(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        public static extern SafeWinHttpHandle WinHttpOpenRequest(
-#endif
             SafeWinHttpHandle connectHandle,
             string verb,
             string objectName,
@@ -69,29 +48,17 @@ internal static partial class Interop
             uint headersLength,
             uint modifiers);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpAddRequestHeaders(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpAddRequestHeaders(
-#endif
             SafeWinHttpHandle requestHandle,
             string headers,
             uint headersLength,
             uint modifiers);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpSendRequest(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpSendRequest(
-#endif
             SafeWinHttpHandle requestHandle,
             IntPtr headers,
             uint headersLength,
@@ -100,53 +67,29 @@ internal static partial class Interop
             uint totalLength,
             IntPtr context);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpReceiveResponse(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpReceiveResponse(
-#endif
             SafeWinHttpHandle requestHandle,
             IntPtr reserved);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpQueryDataAvailable(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpQueryDataAvailable(
-#endif
             SafeWinHttpHandle requestHandle,
             IntPtr parameterIgnoredAndShouldBeNullForAsync);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpReadData(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpReadData(
-#endif
             SafeWinHttpHandle requestHandle,
             IntPtr buffer,
             uint bufferSize,
             IntPtr parameterIgnoredAndShouldBeNullForAsync);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpQueryHeaders(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpQueryHeaders(
-#endif
             SafeWinHttpHandle requestHandle,
             uint infoLevel,
             string name,
@@ -154,15 +97,9 @@ internal static partial class Interop
             ref uint bufferLength,
             ref uint index);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpQueryHeaders(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpQueryHeaders(
-#endif
             SafeWinHttpHandle requestHandle,
             uint infoLevel,
             string name,
@@ -170,99 +107,57 @@ internal static partial class Interop
             ref uint bufferLength,
             IntPtr index);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpQueryOption(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpQueryOption(
-#endif
             SafeWinHttpHandle handle,
             uint option,
             ref IntPtr buffer,
             ref uint bufferSize);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpQueryOption(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpQueryOption(
-#endif
             SafeWinHttpHandle handle,
             uint option,
             IntPtr buffer,
             ref uint bufferSize);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpQueryOption(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpQueryOption(
-#endif
             SafeWinHttpHandle handle,
             uint option,
             ref uint buffer,
             ref uint bufferSize);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpWriteData(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpWriteData(
-#endif
             SafeWinHttpHandle requestHandle,
             IntPtr buffer,
             uint bufferSize,
             IntPtr parameterIgnoredAndShouldBeNullForAsync);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpSetOption(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpSetOption(
-#endif
             SafeWinHttpHandle handle,
             uint option,
             ref uint optionData,
             uint optionLength = sizeof(uint));
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpSetOption(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpSetOption(
-#endif
             SafeWinHttpHandle handle,
             uint option,
             IntPtr optionData,
             uint optionLength);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpSetCredentials(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpSetCredentials(
-#endif
             SafeWinHttpHandle requestHandle,
             uint authTargets,
             uint authScheme,
@@ -270,44 +165,26 @@ internal static partial class Interop
             string? password,
             IntPtr reserved);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpQueryAuthSchemes(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpQueryAuthSchemes(
-#endif
             SafeWinHttpHandle requestHandle,
             out uint supportedSchemes,
             out uint firstScheme,
             out uint authTarget);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpSetTimeouts(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpSetTimeouts(
-#endif
             SafeWinHttpHandle handle,
             int resolveTimeout,
             int connectTimeout,
             int sendTimeout,
             int receiveTimeout);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         [return: MarshalAs(UnmanagedType.Bool)]
         public static partial bool WinHttpGetIEProxyConfigForCurrentUser(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool WinHttpGetIEProxyConfigForCurrentUser(
-#endif
             out WINHTTP_CURRENT_USER_IE_PROXY_CONFIG proxyConfig);
 
         [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
@@ -317,13 +194,8 @@ internal static partial class Interop
             ref WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions,
             out WINHTTP_PROXY_INFO proxyInfo);
 
-#if DLLIMPORTGENERATOR_ENABLED
         [GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
         public static partial IntPtr WinHttpSetStatusCallback(
-#else
-        [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
-        public static extern IntPtr WinHttpSetStatusCallback(
-#endif
             SafeWinHttpHandle handle,
             WINHTTP_STATUS_CALLBACK callback,
             uint notificationFlags,
index 264c130..932e729 100644 (file)
@@ -9,6 +9,7 @@
     <!-- Use targeting pack references instead of granular ones in the project file. -->
     <DisableImplicitAssemblyReferences>false</DisableImplicitAssemblyReferences>
     <IncludePlatformAttributes>true</IncludePlatformAttributes>
+    <EnableDllImportGenerator>true</EnableDllImportGenerator>
     <PackageDescription>Console logger provider implementation for Microsoft.Extensions.Logging.</PackageDescription>
   </PropertyGroup>
 
     <PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
   </ItemGroup>
 
+  <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
+    <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.CompilerServices.Unsafe\src\System.Runtime.CompilerServices.Unsafe.ilproj" />
+  </ItemGroup>
+
   <ItemGroup>
     <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.DependencyInjection.Abstractions\src\Microsoft.Extensions.DependencyInjection.Abstractions.csproj" />
     <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Logging\src\Microsoft.Extensions.Logging.csproj" />
index a576730..d9b6355 100644 (file)
@@ -142,10 +142,11 @@ System.IO.Ports.SerialPort</PackageDescription>
     <Reference Include="System.Collections" />
     <Reference Include="System.Collections.Concurrent" Condition="'$(TargetsUnix)' == 'true'" />
     <Reference Include="System.ComponentModel.Primitives" />
-    <Reference Include="System.Memory" Condition="'$(TargetPlatformIdentifier)' == 'windows'" />
+    <Reference Include="System.Memory" />
     <Reference Include="System.Net.Primitives" />
     <Reference Include="System.Net.Sockets" Condition="'$(TargetsUnix)' == 'true'" />
     <Reference Include="System.Runtime" />
+    <Reference Include="System.Runtime.CompilerServices.Unsafe" />
     <Reference Include="System.Runtime.InteropServices" />
     <Reference Include="System.Runtime.InteropServices.RuntimeInformation" Condition="'$(TargetsUnix)' == 'true'" />
     <Reference Include="System.Text.Encoding.Extensions" />
index 3e274f6..3ff1055 100644 (file)
@@ -119,6 +119,7 @@ System.Net.Http.WinHttpHandler</PackageDescription>
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Net.Primitives" />
     <Reference Include="System.Runtime" />
+    <Reference Include="System.Runtime.CompilerServices.Unsafe" />
     <Reference Include="System.Runtime.InteropServices" />
     <Reference Include="System.Security.Cryptography.Encoding" />
     <Reference Include="System.Security.Cryptography.X509Certificates" />
index 95be653..381230d 100644 (file)
@@ -5,6 +5,7 @@
     <StringResourcesPath>../../src/Resources/Strings.resx</StringResourcesPath>
     <TargetFrameworks>$(NetCoreAppCurrent)-windows</TargetFrameworks>
     <DefineConstants>UNITTEST</DefineConstants>
+    <EnableDllImportGenerator>true</EnableDllImportGenerator>
     <Nullable>annotations</Nullable>
   </PropertyGroup>
   <ItemGroup>
index 550d474..5d64f7d 100644 (file)
@@ -21,7 +21,4 @@
       -->
     <CompilerVisibleProperty Include="DllImportGenerator_UseInternalUnsafeType" />
   </ItemGroup>
-  <PropertyGroup Condition="'$(SetDllImportGeneratorConstants)' != 'false'">
-    <DefineConstants>$(DefineConstants);DLLIMPORTGENERATOR_ENABLED</DefineConstants>
-  </PropertyGroup>
 </Project>
index 2a3da62..9ccb53c 100644 (file)
@@ -650,6 +650,7 @@ System.Security.Cryptography.Pkcs.EnvelopedCms</PackageDescription>
     <Reference Include="System.Memory" />
     <Reference Include="System.Resources.ResourceManager" />
     <Reference Include="System.Runtime" />
+    <Reference Include="System.Runtime.CompilerServices.Unsafe" />
     <Reference Include="System.Runtime.Extensions" />
     <Reference Include="System.Runtime.InteropServices" />
     <Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
index 8b6ce7b..a35f104 100644 (file)
@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <Nullable>annotations</Nullable>
     <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum)</TargetFrameworks>
     <IsPackable>true</IsPackable>
     <PackageDescription>Provides miscellaneous Windows-specific types
@@ -93,6 +94,7 @@ System.Security.Cryptography.X509Certificates.X509SelectionFlag</PackageDescript
     <Reference Include="System.Memory" />
     <Reference Include="System.Net.Requests" />
     <Reference Include="System.Resources.ResourceManager" />
+    <Reference Include="System.Runtime.CompilerServices.Unsafe" />
     <Reference Include="System.Runtime.Extensions" />
     <Reference Include="System.Runtime.InteropServices" />
     <Reference Include="System.Runtime" />