From e7600e00800e0ee9826ba97146f1da8a1250ccae Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Fri, 12 Nov 2021 11:08:39 -0800 Subject: [PATCH] Remove all DLLIMPORTGENERATOR_ENABLED usage. (#61476) * Remove all DLLIMPORTGENERATOR_ENABLED usage. * Explicitly set EnableDllImportGenerator to true in test project. --- eng/generators.targets | 1 - .../Advapi32/Interop.CryptAcquireContext.cs | 5 - .../Advapi32/Interop.CryptDestroyHash.cs | 5 - .../Advapi32/Interop.CryptDestroyKey.cs | 5 - .../Advapi32/Interop.CryptGetProvParam.cs | 15 -- .../Advapi32/Interop.CryptReleaseContext.cs | 5 - .../Advapi32/Interop.EncryptDecrypt.cs | 10 -- ....OpenProcessToken_SafeAccessTokenHandle.cs | 5 - .../Windows/Crypt32/Interop.CertCloseStore.cs | 5 - ...Interop.CertDuplicateCertificateContext.cs | 5 - .../Interop.CertEnumCertificatesInStore.cs | 5 - .../Interop.CertFreeCertificateContext.cs | 5 - ...terop.CertGetCertificateContextProperty.cs | 27 ---- ...tCertificateContextProperty_NO_NULLABLE.cs | 9 -- .../Windows/Crypt32/Interop.CertNameToStr.cs | 5 - .../Windows/Crypt32/Interop.CryptMsgClose.cs | 5 - .../Crypt32/Interop.CryptMsgGetParam.cs | 20 --- .../Windows/Crypt32/Interop.certificates.cs | 12 -- .../Windows/Kernel32/Interop.CreateFile.cs | 5 - .../Kernel32/Interop.FlushFileBuffers.cs | 6 - .../Kernel32/Interop.GetConsoleMode.cs | 10 -- .../Interop.GetFileType_SafeHandle.cs | 5 - .../Interop.ReadFile_SafeHandle_IntPtr.cs | 5 - ...op.ReadFile_SafeHandle_NativeOverlapped.cs | 10 -- .../Kernel32/Interop.SetConsoleCtrlHandler.cs | 5 - .../Interop.WriteFile_SafeHandle_IntPtr.cs | 5 - ...p.WriteFile_SafeHandle_NativeOverlapped.cs | 10 -- .../Windows/NCrypt/Interop.Properties.cs | 10 -- .../Windows/WinHttp/Interop.winhttp.cs | 128 ------------------ ...icrosoft.Extensions.Logging.Console.csproj | 5 + .../src/System.IO.Ports.csproj | 3 +- .../src/System.Net.Http.WinHttpHandler.csproj | 1 + ....Net.Http.WinHttpHandler.Unit.Tests.csproj | 1 + ...Microsoft.Interop.DllImportGenerator.props | 3 - .../System.Security.Cryptography.Pkcs.csproj | 1 + .../src/System.Windows.Extensions.csproj | 2 + 36 files changed, 12 insertions(+), 352 deletions(-) diff --git a/eng/generators.targets b/eng/generators.targets index 53a0286da7e36..bcedd85243ed3 100644 --- a/eng/generators.targets +++ b/eng/generators.targets @@ -3,7 +3,6 @@ true - false true diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptAcquireContext.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptAcquireContext.cs index d45b7e14e9200..bffdc2007e912 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptAcquireContext.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptAcquireContext.cs @@ -20,13 +20,8 @@ internal enum CryptAcquireContextFlags : uint 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, diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyHash.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyHash.cs index 8635ce377299c..5c2b78f75edff 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyHash.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyHash.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyKey.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyKey.cs index 5bc36fbfd6c15..07074948d46b2 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyKey.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDestroyKey.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetProvParam.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetProvParam.cs index d5a6b6dcb5f8c..bacf09eb89d20 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetProvParam.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetProvParam.cs @@ -22,37 +22,22 @@ internal enum CryptProvParam : int 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, diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptReleaseContext.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptReleaseContext.cs index f36800f515057..30c806a0770a0 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptReleaseContext.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptReleaseContext.cs @@ -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); } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EncryptDecrypt.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EncryptDecrypt.cs index 659fbe352c687..2b60007102466 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EncryptDecrypt.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EncryptDecrypt.cs @@ -11,13 +11,8 @@ internal static partial class Advapi32 /// /// WARNING: This method does not implicitly handle long paths. Use EncryptFile. /// -#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 bool EncryptFile(string path) /// /// WARNING: This method does not implicitly handle long paths. Use DecryptFile. /// -#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); diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.OpenProcessToken_SafeAccessTokenHandle.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.OpenProcessToken_SafeAccessTokenHandle.cs index bf48ccbd086b5..3d47f27295f6f 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.OpenProcessToken_SafeAccessTokenHandle.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.OpenProcessToken_SafeAccessTokenHandle.cs @@ -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); diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertCloseStore.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertCloseStore.cs index f26df2d4d8e5c..abeccccd292b4 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertCloseStore.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertCloseStore.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertDuplicateCertificateContext.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertDuplicateCertificateContext.cs index 3ebbb872aa4a3..e87fbd6f8eb99 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertDuplicateCertificateContext.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertDuplicateCertificateContext.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertEnumCertificatesInStore.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertEnumCertificatesInStore.cs index 50cb6c5997be0..be2172e6e1198 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertEnumCertificatesInStore.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertEnumCertificatesInStore.cs @@ -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); } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertFreeCertificateContext.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertFreeCertificateContext.cs index 9158b597dbbb7..11ad3eb329704 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertFreeCertificateContext.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertFreeCertificateContext.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs index fbc2a1561b71b..a6a2001e28973 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs @@ -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 bool CertGetCertificateContextProperty( 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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs index 5f8c59d67c24f..545cbe60ab87b 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertNameToStr.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertNameToStr.cs index 534dc6418c9c7..0228f4b78da75 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertNameToStr.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertNameToStr.cs @@ -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, diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgClose.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgClose.cs index f4235e3d178bb..03b528c439552 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgClose.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgClose.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgGetParam.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgGetParam.cs index 8795a15d00950..a16ef678cd75c 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgGetParam.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgGetParam.cs @@ -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, diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.certificates.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.certificates.cs index e61361bfa8ae7..648708689a25c 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.certificates.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.certificates.cs @@ -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, diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateFile.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateFile.cs index f26661c5e2635..b62016d77b92d 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateFile.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateFile.cs @@ -13,13 +13,8 @@ internal static partial class Kernel32 /// /// WARNING: This method does not implicitly handle long paths. Use CreateFile. /// -#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, diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs index 9b0e8571854e3..689e44321e72e 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs index b03d88f475094..6eb46b1f4b6d9 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs @@ -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 bool IsGetConsoleModeCallSuccessful(IntPtr handle) 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; diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs index d5d2062f05d13..76f99ac51b7d7 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs @@ -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 } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs index 9651a10fb64bd..00b66c4ccde30 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs @@ -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, diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs index ba9b6a91c0eb6..ceebb111aab37 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs @@ -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, diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetConsoleCtrlHandler.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetConsoleCtrlHandler.cs index 8a64d27c19660..27c62e01c465e 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetConsoleCtrlHandler.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.SetConsoleCtrlHandler.cs @@ -13,12 +13,7 @@ internal static partial class Kernel32 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 handler, bool Add); -#else - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe bool SetConsoleCtrlHandler(delegate* unmanaged HandlerRoutine, bool Add); -#endif } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs index 6354c1a5926b4..0e7cc88f1b49b 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs @@ -15,13 +15,8 @@ internal static partial class Kernel32 // 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, diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs index 0f66079a24a9e..3ae10aaab16ed 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs @@ -15,26 +15,16 @@ internal static partial class Kernel32 // 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, diff --git a/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Properties.cs b/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Properties.cs index 4304ccf9bbf4c..d160b1a7d42c9 100644 --- a/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Properties.cs +++ b/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Properties.cs @@ -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 extern unsafe ErrorCode NCryptGetProperty( 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, diff --git a/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp.cs b/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp.cs index c09f70be31399..85ca830e06f18 100644 --- a/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp.cs +++ b/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp.cs @@ -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 @@ public static extern bool WinHttpAddRequestHeaders( 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 @@ public static extern bool WinHttpSendRequest( 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 @@ public static extern bool WinHttpQueryHeaders( 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 @@ public static extern bool WinHttpQueryHeaders( 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 @@ public static extern bool WinHttpSetCredentials( 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 @@ public static extern bool WinHttpGetProxyForUrl( 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, diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj b/src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj index 264c1302c41b8..932e729c0b9ad 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj @@ -9,6 +9,7 @@ false true + true Console logger provider implementation for Microsoft.Extensions.Logging. @@ -42,6 +43,10 @@ + + + + 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 a576730127f68..d9b6355b234af 100644 --- a/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj +++ b/src/libraries/System.IO.Ports/src/System.IO.Ports.csproj @@ -142,10 +142,11 @@ System.IO.Ports.SerialPort - + + diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj index 3e274f6d3547b..3ff105557a87b 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj @@ -119,6 +119,7 @@ System.Net.Http.WinHttpHandler + diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj b/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj index 95be65335cc3a..381230d2a9bc3 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj @@ -5,6 +5,7 @@ ../../src/Resources/Strings.resx $(NetCoreAppCurrent)-windows UNITTEST + true annotations diff --git a/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/Microsoft.Interop.DllImportGenerator.props b/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/Microsoft.Interop.DllImportGenerator.props index 550d474720ea1..5d64f7df4a832 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/Microsoft.Interop.DllImportGenerator.props +++ b/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/Microsoft.Interop.DllImportGenerator.props @@ -21,7 +21,4 @@ --> - - $(DefineConstants);DLLIMPORTGENERATOR_ENABLED - diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj b/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj index 2a3da6228dceb..9ccb53cebf207 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj +++ b/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj @@ -650,6 +650,7 @@ System.Security.Cryptography.Pkcs.EnvelopedCms + diff --git a/src/libraries/System.Windows.Extensions/src/System.Windows.Extensions.csproj b/src/libraries/System.Windows.Extensions/src/System.Windows.Extensions.csproj index 8b6ce7bb7f1f3..a35f1040ba942 100644 --- a/src/libraries/System.Windows.Extensions/src/System.Windows.Extensions.csproj +++ b/src/libraries/System.Windows.Extensions/src/System.Windows.Extensions.csproj @@ -1,6 +1,7 @@ true + annotations $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum) true Provides miscellaneous Windows-specific types @@ -93,6 +94,7 @@ System.Security.Cryptography.X509Certificates.X509SelectionFlag +