diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptProtectData.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptProtectData.cs index 6fab3a93fad5f..bf6cc60b98503 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptProtectData.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptProtectData.cs @@ -13,7 +13,7 @@ internal static partial class Crypt32 [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptProtectData( [In] ref DATA_BLOB pDataIn, - [In] string? szDataDescr, + [In] string szDataDescr, [In] ref DATA_BLOB pOptionalEntropy, [In] IntPtr pvReserved, [In] IntPtr pPromptStruct, diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FormatMessage.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FormatMessage.cs index 4c780c0069643..53b0ad25573dd 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FormatMessage.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FormatMessage.cs @@ -53,11 +53,7 @@ internal static unsafe string GetMessage(int errorCode, IntPtr moduleHandle) // We got back an error. If the error indicated that there wasn't enough room to store // the error message, then call FormatMessage again, but this time rather than passing in // a buffer, have the method allocate one, which we then need to free. -#if NET6_0 - if (Marshal.GetLastPInvokeError() == ERROR_INSUFFICIENT_BUFFER) -#else if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) -#endif { IntPtr nativeMsgPtr = default; try diff --git a/src/libraries/Common/src/System/IO/Win32Marshal.cs b/src/libraries/Common/src/System/IO/Win32Marshal.cs index f062429fd767d..2bb328411d993 100644 --- a/src/libraries/Common/src/System/IO/Win32Marshal.cs +++ b/src/libraries/Common/src/System/IO/Win32Marshal.cs @@ -15,13 +15,9 @@ internal static class Win32Marshal /// Converts, resetting it, the last Win32 error into a corresponding object, optionally /// including the specified path in the error message. /// -#if NET6_0 internal static Exception GetExceptionForLastWin32Error(string? path = "") - => GetExceptionForWin32Error(Marshal.GetLastPInvokeError(), path); -#else - internal static Exception GetExceptionForLastWin32Error(string? path = "") => GetExceptionForWin32Error(Marshal.GetLastWin32Error(), path); -#endif + /// /// Converts the specified Win32 error into a corresponding object, optionally /// including the specified path in the error message. diff --git a/src/libraries/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.cs b/src/libraries/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.cs index a2b1644108098..bf78cbc03c926 100644 --- a/src/libraries/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.cs +++ b/src/libraries/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.cs @@ -21,7 +21,7 @@ public partial class Win32Exception : ExternalException, ISerializable /// Initializes a new instance of the class with the last Win32 error /// that occurred. /// - public Win32Exception() : this(Marshal.GetLastWin32Error()) + public Win32Exception() : this(Marshal.GetLastPInvokeError()) { } @@ -43,7 +43,7 @@ public Win32Exception(int error, string? message) : base(message) /// /// Initializes a new instance of the Exception class with a specified error message. /// - public Win32Exception(string? message) : this(Marshal.GetLastWin32Error(), message) + public Win32Exception(string? message) : this(Marshal.GetLastPInvokeError(), message) { } @@ -53,7 +53,7 @@ public Win32Exception(string? message) : this(Marshal.GetLastWin32Error(), messa /// public Win32Exception(string? message, Exception? innerException) : base(message, innerException) { - NativeErrorCode = Marshal.GetLastWin32Error(); + NativeErrorCode = Marshal.GetLastPInvokeError(); } protected Win32Exception(SerializationInfo info, StreamingContext context) : base(info, context) diff --git a/src/libraries/Microsoft.Win32.Primitives/tests/Win32ExceptionTests.cs b/src/libraries/Microsoft.Win32.Primitives/tests/Win32ExceptionTests.cs index 04a1dfca13be1..27bdd0860086b 100644 --- a/src/libraries/Microsoft.Win32.Primitives/tests/Win32ExceptionTests.cs +++ b/src/libraries/Microsoft.Win32.Primitives/tests/Win32ExceptionTests.cs @@ -38,7 +38,7 @@ private static bool IsExceptionMessageLong(int errorCode) null); if (result == 0) { - return (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER); + return (Marshal.GetLastPInvokeError() == ERROR_INSUFFICIENT_BUFFER); } return false; diff --git a/src/libraries/System.Console/src/System/ConsolePal.Windows.cs b/src/libraries/System.Console/src/System/ConsolePal.Windows.cs index dd74a7d826e97..95cebc12c4887 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.Windows.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.Windows.cs @@ -109,7 +109,7 @@ public static void SetConsoleInputEncoding(Encoding enc) if (enc.CodePage != UnicodeCodePage) { if (!Interop.Kernel32.SetConsoleCP(enc.CodePage)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } } @@ -123,7 +123,7 @@ public static void SetConsoleOutputEncoding(Encoding enc) if (enc.CodePage != UnicodeCodePage) { if (!Interop.Kernel32.SetConsoleOutputCP(enc.CodePage)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } } @@ -280,7 +280,7 @@ public static bool KeyAvailable bool r = Interop.Kernel32.PeekConsoleInput(InputHandle, out ir, 1, out numEventsRead); if (!r) { - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); if (errorCode == Interop.Errors.ERROR_INVALID_HANDLE) throw new InvalidOperationException(SR.InvalidOperation_ConsoleKeyAvailableOnFile); throw Win32Marshal.GetExceptionForWin32Error(errorCode, "stdin"); @@ -295,7 +295,7 @@ public static bool KeyAvailable r = Interop.Kernel32.ReadConsoleInput(InputHandle, out ir, 1, out numEventsRead); if (!r) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } else { @@ -413,7 +413,7 @@ public static bool TreatControlCAsInput int mode = 0; if (!Interop.Kernel32.GetConsoleMode(handle, out mode)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); return (mode & Interop.Kernel32.ENABLE_PROCESSED_INPUT) == 0; } @@ -425,7 +425,7 @@ public static bool TreatControlCAsInput int mode = 0; if (!Interop.Kernel32.GetConsoleMode(handle, out mode)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); if (value) { @@ -437,7 +437,7 @@ public static bool TreatControlCAsInput } if (!Interop.Kernel32.SetConsoleMode(handle, mode)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } } @@ -534,7 +534,7 @@ public static int CursorSize { Interop.Kernel32.CONSOLE_CURSOR_INFO cci; if (!Interop.Kernel32.GetConsoleCursorInfo(OutputHandle, out cci)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); return cci.dwSize; } @@ -546,11 +546,11 @@ public static int CursorSize Interop.Kernel32.CONSOLE_CURSOR_INFO cci; if (!Interop.Kernel32.GetConsoleCursorInfo(OutputHandle, out cci)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); cci.dwSize = value; if (!Interop.Kernel32.SetConsoleCursorInfo(OutputHandle, ref cci)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } } @@ -560,7 +560,7 @@ public static bool CursorVisible { Interop.Kernel32.CONSOLE_CURSOR_INFO cci; if (!Interop.Kernel32.GetConsoleCursorInfo(OutputHandle, out cci)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); return cci.bVisible; } @@ -568,11 +568,11 @@ public static bool CursorVisible { Interop.Kernel32.CONSOLE_CURSOR_INFO cci; if (!Interop.Kernel32.GetConsoleCursorInfo(OutputHandle, out cci)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); cci.bVisible = value; if (!Interop.Kernel32.SetConsoleCursorInfo(OutputHandle, ref cci)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } } @@ -604,7 +604,7 @@ public static unsafe string Title if (result == 0) { - int error = Marshal.GetLastWin32Error(); + int error = Marshal.GetLastPInvokeError(); switch (error) { case Interop.Errors.ERROR_INSUFFICIENT_BUFFER: @@ -639,7 +639,7 @@ public static unsafe string Title set { if (!Interop.Kernel32.SetConsoleTitle(value)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } } @@ -715,7 +715,7 @@ public static unsafe void MoveBufferArea(int sourceLeft, int sourceTop, fixed (Interop.Kernel32.CHAR_INFO* pCharInfo = data) r = Interop.Kernel32.ReadConsoleOutput(OutputHandle, pCharInfo, bufferSize, bufferCoord, ref readRegion); if (!r) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); // Overwrite old section Interop.Kernel32.COORD writeCoord = default; @@ -730,11 +730,11 @@ public static unsafe void MoveBufferArea(int sourceLeft, int sourceTop, r = Interop.Kernel32.FillConsoleOutputCharacter(OutputHandle, sourceChar, sourceWidth, writeCoord, out numWritten); Debug.Assert(numWritten == sourceWidth, "FillConsoleOutputCharacter wrote the wrong number of chars!"); if (!r) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); r = Interop.Kernel32.FillConsoleOutputAttribute(OutputHandle, attr, sourceWidth, writeCoord, out numWritten); if (!r) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } // Write text to new location @@ -771,7 +771,7 @@ public static void Clear() success = Interop.Kernel32.FillConsoleOutputCharacter(hConsole, ' ', conSize, coordScreen, out numCellsWritten); if (!success) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); // now set the buffer's attributes accordingly @@ -779,13 +779,13 @@ public static void Clear() success = Interop.Kernel32.FillConsoleOutputAttribute(hConsole, csbi.wAttributes, conSize, coordScreen, out numCellsWritten); if (!success) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); // put the cursor at (0, 0) success = Interop.Kernel32.SetConsoleCursorPosition(hConsole, coordScreen); if (!success) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } public static void SetCursorPosition(int left, int top) @@ -797,7 +797,7 @@ public static void SetCursorPosition(int left, int top) if (!Interop.Kernel32.SetConsoleCursorPosition(hConsole, coords)) { // Give a nice error message for out of range sizes - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); Interop.Kernel32.CONSOLE_SCREEN_BUFFER_INFO csbi = GetBufferInfo(); if (left >= csbi.dwSize.X) throw new ArgumentOutOfRangeException(nameof(left), left, SR.ArgumentOutOfRange_ConsoleBufferBoundaries); @@ -849,7 +849,7 @@ public static void SetBufferSize(int width, int height) size.Y = (short)height; if (!Interop.Kernel32.SetConsoleScreenBufferSize(OutputHandle, size)) { - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } } @@ -951,7 +951,7 @@ public static unsafe void SetWindowPosition(int left, int top) bool r = Interop.Kernel32.SetConsoleWindowInfo(OutputHandle, true, &srWindow); if (!r) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } public static unsafe void SetWindowSize(int width, int height) @@ -987,7 +987,7 @@ public static unsafe void SetWindowSize(int width, int height) if (resizeBuffer) { if (!Interop.Kernel32.SetConsoleScreenBufferSize(OutputHandle, size)) - throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); + throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError()); } Interop.Kernel32.SMALL_RECT srWindow = csbi.srWindow; @@ -997,7 +997,7 @@ public static unsafe void SetWindowSize(int width, int height) if (!Interop.Kernel32.SetConsoleWindowInfo(OutputHandle, true, &srWindow)) { - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); // If we resized the buffer, un-resize it. if (resizeBuffer) @@ -1070,7 +1070,7 @@ private static Interop.Kernel32.CONSOLE_SCREEN_BUFFER_INFO GetBufferInfo(bool th !Interop.Kernel32.GetConsoleScreenBufferInfo(ErrorHandle, out csbi) && !Interop.Kernel32.GetConsoleScreenBufferInfo(InputHandle, out csbi)) { - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); if (errorCode == Interop.Errors.ERROR_INVALID_HANDLE && !throwOnNoConsole) return default; throw Win32Marshal.GetExceptionForWin32Error(errorCode); @@ -1178,7 +1178,7 @@ private static unsafe int ReadFileNative(IntPtr hFile, Span buffer, bool i // For pipes that are closing or broken, just stop. // (E.g. ERROR_NO_DATA ("pipe is being closed") is returned when we write to a console that is closing; // ERROR_BROKEN_PIPE ("pipe was closed") is returned when stdin was closed, which is not an error, but EOF.) - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); if (errorCode == Interop.Errors.ERROR_NO_DATA || errorCode == Interop.Errors.ERROR_BROKEN_PIPE) return Interop.Errors.ERROR_SUCCESS; return errorCode; @@ -1218,7 +1218,7 @@ private static unsafe int WriteFileNative(IntPtr hFile, ReadOnlySpan bytes // For pipes that are closing or broken, just stop. // (E.g. ERROR_NO_DATA ("pipe is being closed") is returned when we write to a console that is closing; // ERROR_BROKEN_PIPE ("pipe was closed") is returned when stdin was closed, which is not an error, but EOF.) - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); if (errorCode == Interop.Errors.ERROR_NO_DATA || errorCode == Interop.Errors.ERROR_BROKEN_PIPE) return Interop.Errors.ERROR_SUCCESS; return errorCode; diff --git a/src/libraries/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln b/src/libraries/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln index 40f2e6c07eb21..0982a373b5cef 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln +++ b/src/libraries/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln @@ -41,9 +41,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{A9FD5D03-151 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices", "..\System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj", "{482DE3DF-83A4-4B1B-BCDB-4E2D057FFB6E}" -EndProject Global + GlobalSection(NestedProjects) = preSolution + {18FD488A-2A3F-4B40-B65D-7108688D350F} = {4C78F34A-DAF6-4298-A4D3-5C8FD380E33B} + {9EB99AA1-EE31-41AC-B3E6-DCD7A01F17F2} = {4C78F34A-DAF6-4298-A4D3-5C8FD380E33B} + {BC0B86CC-54C1-450F-A710-13A66571EEBE} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {071FC282-9840-4920-B0FD-BE778449B5FF} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {C0B560B2-72A0-41B2-82D5-34EF31719AD7} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {D7E6A261-C80A-4E51-BCDD-85DD595866B9} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {3709D2F4-5495-447A-81D1-D022B5A22DF9} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {1AC0BFF9-2F4E-4E6A-8A5A-89DFF3AE2C74} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {37F8ED93-FD45-4941-B83E-84D278B8EA83} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {EAAF9D04-EB06-48C5-B678-662C777FBC7D} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {F33F1171-273A-4BC3-B138-25E5E7118186} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} + {4EF591E4-175E-494D-8191-15C2D6C6E2E6} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} + {35D57A83-8A9D-4531-BF0D-EA1BCA62D475} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} + {0EB6C67A-FD15-48A6-A608-F7E27DA8DB7E} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} + {62B4CB1C-16EE-4B2F-9FF1-DF2770A056F9} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} + {87E03C4D-FFE2-43AD-9CFE-BB67A2448186} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} + {4C5EE1EB-EACF-4A3A-88EC-CA7B3B7D50BA} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} + {83F2D6C4-C3C7-4428-A0CA-577162C5DBCA} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -121,35 +139,10 @@ Global {83F2D6C4-C3C7-4428-A0CA-577162C5DBCA}.Debug|Any CPU.Build.0 = Debug|Any CPU {83F2D6C4-C3C7-4428-A0CA-577162C5DBCA}.Release|Any CPU.ActiveCfg = Release|Any CPU {83F2D6C4-C3C7-4428-A0CA-577162C5DBCA}.Release|Any CPU.Build.0 = Release|Any CPU - {482DE3DF-83A4-4B1B-BCDB-4E2D057FFB6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {482DE3DF-83A4-4B1B-BCDB-4E2D057FFB6E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {482DE3DF-83A4-4B1B-BCDB-4E2D057FFB6E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {482DE3DF-83A4-4B1B-BCDB-4E2D057FFB6E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {18FD488A-2A3F-4B40-B65D-7108688D350F} = {4C78F34A-DAF6-4298-A4D3-5C8FD380E33B} - {BC0B86CC-54C1-450F-A710-13A66571EEBE} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {071FC282-9840-4920-B0FD-BE778449B5FF} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {4EF591E4-175E-494D-8191-15C2D6C6E2E6} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} - {C0B560B2-72A0-41B2-82D5-34EF31719AD7} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {D7E6A261-C80A-4E51-BCDD-85DD595866B9} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {35D57A83-8A9D-4531-BF0D-EA1BCA62D475} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} - {9EB99AA1-EE31-41AC-B3E6-DCD7A01F17F2} = {4C78F34A-DAF6-4298-A4D3-5C8FD380E33B} - {3709D2F4-5495-447A-81D1-D022B5A22DF9} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {0EB6C67A-FD15-48A6-A608-F7E27DA8DB7E} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} - {1AC0BFF9-2F4E-4E6A-8A5A-89DFF3AE2C74} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {62B4CB1C-16EE-4B2F-9FF1-DF2770A056F9} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} - {37F8ED93-FD45-4941-B83E-84D278B8EA83} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {87E03C4D-FFE2-43AD-9CFE-BB67A2448186} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} - {EAAF9D04-EB06-48C5-B678-662C777FBC7D} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {4C5EE1EB-EACF-4A3A-88EC-CA7B3B7D50BA} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} - {F33F1171-273A-4BC3-B138-25E5E7118186} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - {83F2D6C4-C3C7-4428-A0CA-577162C5DBCA} = {2A945EB8-D29E-4FFA-A3AA-AF2D5EDAF6B1} - {482DE3DF-83A4-4B1B-BCDB-4E2D057FFB6E} = {A9FD5D03-1516-47D5-8CF4-FD9512E8CADB} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {246C2EDA-448E-4E76-B97A-BD93DC6883A7} EndGlobalSection diff --git a/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj b/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj index 496aa1613ff3d..503971f5c7a22 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj +++ b/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj @@ -1,4 +1,4 @@ - + $(NetCoreAppCurrent)-windows;netstandard2.0;netstandard2.0-windows;net461-windows true diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs index d361611377ed1..bb495b09c1310 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs +++ b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Windows.cs @@ -149,7 +149,7 @@ public unsafe string VolumeLabel bool r = Interop.Kernel32.SetVolumeLabel(Name, value); if (!r) { - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); // Provide better message if (errorCode == Interop.Errors.ERROR_ACCESS_DENIED) throw new UnauthorizedAccessException(SR.InvalidOperation_SetVolumeLabelFailed); diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/Error.cs b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/Error.cs index 90998a89f81cf..bf8141073883e 100644 --- a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/Error.cs +++ b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/Error.cs @@ -13,7 +13,7 @@ internal static class Error // An alternative to Win32Marshal with friendlier messages for drives internal static Exception GetExceptionForLastWin32DriveError(string driveName) { - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); return GetExceptionForWin32DriveError(errorCode, driveName); } diff --git a/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs b/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs index 2081e679cbc17..1bbc4648bf832 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs @@ -349,7 +349,7 @@ internal unsafe void Start(CancellationToken cancellationToken) if (!Interop.EventStream.FSEventStreamStart(_eventStream)) { // Try to get the Watcher to raise the error event; if we can't do that, just silently exit since the watcher is gone anyway - int error = Marshal.GetLastWin32Error(); + int error = Marshal.GetLastPInvokeError(); if (_weakWatcher.TryGetTarget(out FileSystemWatcher? watcher)) { // An error occurred while trying to start the run loop so fail out diff --git a/src/libraries/System.IO.FileSystem/tests/PortedCommon/IOServices.cs b/src/libraries/System.IO.FileSystem/tests/PortedCommon/IOServices.cs index 3fb3066d17f54..27b923dbd39c2 100644 --- a/src/libraries/System.IO.FileSystem/tests/PortedCommon/IOServices.cs +++ b/src/libraries/System.IO.FileSystem/tests/PortedCommon/IOServices.cs @@ -244,7 +244,7 @@ public static long GetAvailableFreeBytes(string drive) long userBytes; if (!DllImports.GetDiskFreeSpaceEx(drive, out userBytes, out ignored, out ignored)) { - throw new IOException("DriveName: " + drive + " ErrorCode:" + Marshal.GetLastWin32Error()); + throw new IOException("DriveName: " + drive + " ErrorCode:" + Marshal.GetLastPInvokeError()); } return userBytes; @@ -257,7 +257,7 @@ private static bool IsReady(string drive) long ignored; if (!DllImports.GetDiskFreeSpaceEx(drive, out ignored, out ignored, out ignored)) { - return Marshal.GetLastWin32Error() != ERROR_NOT_READY; + return Marshal.GetLastPInvokeError() != ERROR_NOT_READY; } return true; diff --git a/src/libraries/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs b/src/libraries/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs index d2304e1213fa0..5423bda6814b3 100644 --- a/src/libraries/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs +++ b/src/libraries/System.IO.FileSystem/tests/PortedCommon/ReparsePointUtilities.cs @@ -72,13 +72,13 @@ public static void Mount(string volumeName, string mountPoint) StringBuilder sb = new StringBuilder(1024); r = GetVolumeNameForVolumeMountPoint(volumeName, sb, sb.Capacity); if (!r) - throw new Exception(string.Format("Win32 error: {0}", Marshal.GetLastWin32Error())); + throw new Exception(string.Format("Win32 error: {0}", Marshal.GetLastPInvokeError())); string uniqueName = sb.ToString(); Console.WriteLine(string.Format("uniqueName: <{0}>", uniqueName)); r = SetVolumeMountPoint(mountPoint, uniqueName); if (!r) - throw new Exception(string.Format("Win32 error: {0}", Marshal.GetLastWin32Error())); + throw new Exception(string.Format("Win32 error: {0}", Marshal.GetLastPInvokeError())); Task.Delay(100).Wait(); // adding sleep for the file system to settle down so that reparse point mounting works } @@ -90,7 +90,7 @@ public static void Unmount(string mountPoint) bool r = DeleteVolumeMountPoint(mountPoint); if (!r) - throw new Exception(string.Format("Win32 error: {0}", Marshal.GetLastWin32Error())); + throw new Exception(string.Format("Win32 error: {0}", Marshal.GetLastPInvokeError())); } /// For standalone debugging help. Change Main0 to Main diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs index ad08669e8e008..8bc32eb666ef8 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs @@ -47,7 +47,7 @@ private static SafeMemoryMappedFileHandle CreateCore( Interop.CreateFileMapping(fileHandle, ref secAttrs, GetPageAccess(access) | (int)options, capacity, mapName) : Interop.CreateFileMapping(new IntPtr(-1), ref secAttrs, GetPageAccess(access) | (int)options, capacity, mapName); - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); if (!handle.IsInvalid) { if (errorCode == Interop.Errors.ERROR_ALREADY_EXISTS) @@ -126,7 +126,7 @@ private static SafeMemoryMappedFileHandle CreateOrOpenCore( else { handle.Dispose(); - int createErrorCode = Marshal.GetLastWin32Error(); + int createErrorCode = Marshal.GetLastPInvokeError(); if (createErrorCode != Interop.Errors.ERROR_ACCESS_DENIED) { throw Win32Marshal.GetExceptionForWin32Error(createErrorCode); @@ -146,7 +146,7 @@ private static SafeMemoryMappedFileHandle CreateOrOpenCore( else { handle.Dispose(); - int openErrorCode = Marshal.GetLastWin32Error(); + int openErrorCode = Marshal.GetLastPInvokeError(); if (openErrorCode != Interop.Errors.ERROR_FILE_NOT_FOUND) { throw Win32Marshal.GetExceptionForWin32Error(openErrorCode); diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs index cc3300c12c9fe..c47852bbb0140 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs @@ -62,7 +62,7 @@ public static MemoryMappedView CreateView(SafeMemoryMappedFileHandle memMappedFi IntPtr tempHandle = Interop.VirtualAlloc( viewHandle, (UIntPtr)(nativeSize != MemoryMappedFile.DefaultSize ? nativeSize : viewSize), Interop.Kernel32.MemOptions.MEM_COMMIT, MemoryMappedFile.GetPageAccess(access)); - int lastError = Marshal.GetLastWin32Error(); + int lastError = Marshal.GetLastPInvokeError(); if (viewHandle.IsInvalid) { viewHandle.Dispose(); @@ -110,7 +110,7 @@ public unsafe void Flush(UIntPtr capacity) // increasing intervals. Eventually, however, we need to give up. In ad-hoc tests // this strategy successfully flushed the view after no more than 3 retries. - int error = Marshal.GetLastWin32Error(); + int error = Marshal.GetLastPInvokeError(); if (error != Interop.Errors.ERROR_LOCK_VIOLATION) throw Win32Marshal.GetExceptionForWin32Error(error); @@ -125,7 +125,7 @@ public unsafe void Flush(UIntPtr capacity) if (Interop.Kernel32.FlushViewOfFile((IntPtr)firstPagePtr, capacity)) return; - error = Marshal.GetLastWin32Error(); + error = Marshal.GetLastPInvokeError(); if (error != Interop.Errors.ERROR_LOCK_VIOLATION) throw Win32Marshal.GetExceptionForWin32Error(error); diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs index a082a3da86397..51c1e58eea813 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs @@ -55,7 +55,7 @@ private bool TryConnect(int timeout, CancellationToken cancellationToken) if (handle.IsInvalid) { - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); if (errorCode != Interop.Errors.ERROR_PIPE_BUSY && errorCode != Interop.Errors.ERROR_FILE_NOT_FOUND) @@ -65,7 +65,7 @@ private bool TryConnect(int timeout, CancellationToken cancellationToken) if (!Interop.Kernel32.WaitNamedPipe(_normalizedPipePath, timeout)) { - errorCode = Marshal.GetLastWin32Error(); + errorCode = Marshal.GetLastPInvokeError(); // Server is not yet created or a timeout occurred before a pipe instance was available. if (errorCode == Interop.Errors.ERROR_FILE_NOT_FOUND || @@ -88,7 +88,7 @@ private bool TryConnect(int timeout, CancellationToken cancellationToken) if (handle.IsInvalid) { - errorCode = Marshal.GetLastWin32Error(); + errorCode = Marshal.GetLastPInvokeError(); // Handle the possible race condition of someone else connecting to the server // between our calls to WaitNamedPipe & CreateFile. @@ -123,7 +123,7 @@ public unsafe int NumberOfServerInstances uint numInstances; if (!Interop.Kernel32.GetNamedPipeHandleStateW(InternalHandle!, null, &numInstances, null, null, null, 0)) { - throw WinIOError(Marshal.GetLastWin32Error()); + throw WinIOError(Marshal.GetLastPInvokeError()); } return (int)numInstances; diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Win32.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Win32.cs index 8039665ac0df5..172c44c3885a2 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Win32.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Win32.cs @@ -26,7 +26,7 @@ private unsafe string HandleGetImpersonationUserNameError(int error, uint userNa { return new string(userName); } - error = Marshal.GetLastWin32Error(); + error = Marshal.GetLastPInvokeError(); } throw WinIOError(error); diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs index a6ed15e1cd379..3abd2fed0451c 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs @@ -146,7 +146,7 @@ public void WaitForConnection() { if (!Interop.Kernel32.ConnectNamedPipe(InternalHandle!, IntPtr.Zero)) { - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); if (errorCode != Interop.Errors.ERROR_PIPE_CONNECTED) { @@ -211,7 +211,7 @@ public unsafe string GetImpersonationUserName() return new string(userName); } - return HandleGetImpersonationUserNameError(Marshal.GetLastWin32Error(), UserNameMaxLength, userName); + return HandleGetImpersonationUserNameError(Marshal.GetLastPInvokeError(), UserNameMaxLength, userName); } // This method calls a delegate while impersonating the client. Note that we will not have @@ -254,7 +254,7 @@ private static void ImpersonateAndTryCode(object? helper) } else { - execHelper._impersonateErrorCode = Marshal.GetLastWin32Error(); + execHelper._impersonateErrorCode = Marshal.GetLastPInvokeError(); } if (execHelper._mustRevert) @@ -272,7 +272,7 @@ private static void RevertImpersonationOnBackout(object? helper, bool exceptionT { if (!Interop.Advapi32.RevertToSelf()) { - execHelper._revertImpersonateErrorCode = Marshal.GetLastWin32Error(); + execHelper._revertImpersonateErrorCode = Marshal.GetLastPInvokeError(); } } } @@ -306,7 +306,7 @@ private unsafe Task WaitForConnectionCoreAsync(CancellationToken cancellationTok if (!Interop.Kernel32.ConnectNamedPipe(InternalHandle!, completionSource.Overlapped)) { - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); switch (errorCode) { diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs index 118463c35d0f7..39f47249a691e 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs @@ -147,7 +147,7 @@ private void Cancel() // This case should not have any consequences although // it will be easier to debug if there exists any special case // we are not aware of. - int errorCode = Marshal.GetLastWin32Error(); + int errorCode = Marshal.GetLastPInvokeError(); Debug.WriteLine("CancelIoEx finished with error code {0}.", errorCode); } } diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs index 928cc5d1a081f..d8c4bf2f8543d 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs @@ -403,7 +403,7 @@ public void WaitForPipeDrain() // Block until other end of the pipe has read everything. if (!Interop.Kernel32.FlushFileBuffers(_handle!)) { - throw WinIOError(Marshal.GetLastWin32Error()); + throw WinIOError(Marshal.GetLastPInvokeError()); } } @@ -420,7 +420,7 @@ public unsafe virtual PipeTransmissionMode TransmissionMode uint pipeFlags; if (!Interop.Kernel32.GetNamedPipeInfo(_handle!, &pipeFlags, null, null, null)) { - throw WinIOError(Marshal.GetLastWin32Error()); + throw WinIOError(Marshal.GetLastPInvokeError()); } if ((pipeFlags & Interop.Kernel32.PipeOptions.PIPE_TYPE_MESSAGE) != 0) { @@ -453,7 +453,7 @@ public unsafe virtual int InBufferSize uint inBufferSize; if (!Interop.Kernel32.GetNamedPipeInfo(_handle!, null, null, &inBufferSize, null)) { - throw WinIOError(Marshal.GetLastWin32Error()); + throw WinIOError(Marshal.GetLastPInvokeError()); } return (int)inBufferSize; @@ -483,7 +483,7 @@ public unsafe virtual int OutBufferSize } else if (!Interop.Kernel32.GetNamedPipeInfo(_handle!, null, &outBufferSize, null, null)) { - throw WinIOError(Marshal.GetLastWin32Error()); + throw WinIOError(Marshal.GetLastPInvokeError()); } return (int)outBufferSize; @@ -519,7 +519,7 @@ public virtual PipeTransmissionMode ReadMode int pipeReadType = (int)value << 1; if (!Interop.Kernel32.SetNamedPipeHandleState(_handle!, &pipeReadType, IntPtr.Zero, IntPtr.Zero)) { - throw WinIOError(Marshal.GetLastWin32Error()); + throw WinIOError(Marshal.GetLastPInvokeError()); } else { @@ -554,7 +554,7 @@ private unsafe int ReadFileNative(SafePipeHandle handle, Span buffer, Nati if (r == 0) { // In message mode, the ReadFile can inform us that there is more data to come. - errorCode = Marshal.GetLastWin32Error(); + errorCode = Marshal.GetLastPInvokeError(); return errorCode == Interop.Errors.ERROR_MORE_DATA ? numBytesRead : -1; @@ -590,7 +590,7 @@ private unsafe int WriteFileNative(SafePipeHandle handle, ReadOnlySpan buf if (r == 0) { - errorCode = Marshal.GetLastWin32Error(); + errorCode = Marshal.GetLastPInvokeError(); return -1; } else @@ -638,7 +638,7 @@ private unsafe void UpdateReadMode() uint flags; if (!Interop.Kernel32.GetNamedPipeHandleStateW(SafePipeHandle, &flags, null, null, null, null, 0)) { - throw WinIOError(Marshal.GetLastWin32Error()); + throw WinIOError(Marshal.GetLastPInvokeError()); } if ((flags & Interop.Kernel32.PipeOptions.PIPE_READMODE_MESSAGE) != 0) diff --git a/src/libraries/System.IO.Pipes/tests/InteropTest.Windows.cs b/src/libraries/System.IO.Pipes/tests/InteropTest.Windows.cs index 087237e2352c6..ce6065d679574 100644 --- a/src/libraries/System.IO.Pipes/tests/InteropTest.Windows.cs +++ b/src/libraries/System.IO.Pipes/tests/InteropTest.Windows.cs @@ -27,7 +27,7 @@ internal static unsafe bool TryGetImpersonationUserName(SafePipeHandle handle, o return true; } - return TryHandleGetImpersonationUserNameError(handle, Marshal.GetLastWin32Error(), UserNameMaxLength, userName, out impersonationUserName); + return TryHandleGetImpersonationUserNameError(handle, Marshal.GetLastPInvokeError(), UserNameMaxLength, userName, out impersonationUserName); } internal static unsafe bool TryGetNumberOfServerInstances(SafePipeHandle handle, out uint numberOfServerInstances) diff --git a/src/libraries/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln b/src/libraries/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln index 223a6b42197bf..f9b2b579d78fd 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln +++ b/src/libraries/System.Net.Http.WinHttpHandler/System.Net.Http.WinHttpHandler.sln @@ -42,6 +42,26 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2E71EAE8-4677-4E28-A2A3-09AD42E702EC}" EndProject Global + GlobalSection(NestedProjects) = preSolution + {49FC63FA-3E81-4335-91CF-B5056E007343} = {D26A4951-218E-4AC9-BDA0-AB7E654E1472} + {E9D5AB56-2597-42E0-BE81-C00CC63D1FB3} = {D26A4951-218E-4AC9-BDA0-AB7E654E1472} + {090BA6CA-F661-4BDE-9663-65F8231DDB1D} = {D26A4951-218E-4AC9-BDA0-AB7E654E1472} + {D18082CB-C337-473B-8AC3-5FCC312F90C6} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} + {845F6CBC-8663-446C-B874-9BE54D2EF6EC} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} + {6FD15E9F-9E3B-494C-8F7F-67C9641A3FDB} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} + {B3C3E9D6-EEB3-4DE1-9B35-C0984474E522} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} + {E2311DD8-2E5E-4DD7-840F-237A8F77A311} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} + {B294FD03-AC49-4235-863F-5966BAB0C84D} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} + {6408B084-5213-4955-8262-6740B96045B2} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} + {4BA25EC1-B76B-4410-AF2D-A54B90FAB404} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} + {7EF13CC5-C714-4C0F-990F-C0884B92A9A1} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} + {E6A8B90B-69CD-4B0D-8A33-F208A3169674} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} + {DE2A69CC-4962-4BF6-A714-41A87A6C045B} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} + {28C24BF8-8E08-485F-8EEE-817EB847774C} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} + {488643D8-1F81-4998-8A6C-E00978977AD2} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} + {BACC5257-6CA8-45C7-970F-C8D501DA59AB} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} + {E470810A-BAF2-4B3C-92CB-72007B7F1B6A} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -123,26 +143,6 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {49FC63FA-3E81-4335-91CF-B5056E007343} = {D26A4951-218E-4AC9-BDA0-AB7E654E1472} - {D18082CB-C337-473B-8AC3-5FCC312F90C6} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} - {4BA25EC1-B76B-4410-AF2D-A54B90FAB404} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} - {845F6CBC-8663-446C-B874-9BE54D2EF6EC} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} - {6FD15E9F-9E3B-494C-8F7F-67C9641A3FDB} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} - {7EF13CC5-C714-4C0F-990F-C0884B92A9A1} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} - {E6A8B90B-69CD-4B0D-8A33-F208A3169674} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} - {B3C3E9D6-EEB3-4DE1-9B35-C0984474E522} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} - {DE2A69CC-4962-4BF6-A714-41A87A6C045B} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} - {E9D5AB56-2597-42E0-BE81-C00CC63D1FB3} = {D26A4951-218E-4AC9-BDA0-AB7E654E1472} - {090BA6CA-F661-4BDE-9663-65F8231DDB1D} = {D26A4951-218E-4AC9-BDA0-AB7E654E1472} - {E2311DD8-2E5E-4DD7-840F-237A8F77A311} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} - {28C24BF8-8E08-485F-8EEE-817EB847774C} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} - {B294FD03-AC49-4235-863F-5966BAB0C84D} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} - {6408B084-5213-4955-8262-6740B96045B2} = {80770A49-D1DC-4FB3-9C3E-3DE94ED72B62} - {488643D8-1F81-4998-8A6C-E00978977AD2} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} - {BACC5257-6CA8-45C7-970F-C8D501DA59AB} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} - {E470810A-BAF2-4B3C-92CB-72007B7F1B6A} = {2E71EAE8-4677-4E28-A2A3-09AD42E702EC} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F5BAF3DD-D05C-4DCC-BB36-16645CA1F151} EndGlobalSection 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 4329efc36955b..3a1719f2c0d6c 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 @@ -1,4 +1,4 @@ - + true netstandard2.0-windows;netstandard2.0;netstandard2.1-windows;netstandard2.1;net461-windows diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerException.cs b/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerException.cs index 62d3751da7482..968adb53345d0 100644 --- a/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerException.cs +++ b/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerException.cs @@ -11,7 +11,7 @@ namespace System.Net [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class HttpListenerException : Win32Exception { - public HttpListenerException() : base(Marshal.GetLastWin32Error()) + public HttpListenerException() : base(Marshal.GetLastPInvokeError()) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, NativeErrorCode.ToString() + ":" + Message); } diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerSession.Windows.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerSession.Windows.cs index 777335be91a98..5c681b745a2f3 100644 --- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerSession.Windows.cs +++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListenerSession.Windows.cs @@ -52,7 +52,7 @@ public unsafe HttpListenerSession(HttpListener listener) Interop.Kernel32.FileCompletionNotificationModes.SkipCompletionPortOnSuccess | Interop.Kernel32.FileCompletionNotificationModes.SkipSetEventOnHandle)) { - throw new HttpListenerException(Marshal.GetLastWin32Error()); + throw new HttpListenerException(Marshal.GetLastPInvokeError()); } RequestQueueHandle = requestQueueHandle; diff --git a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs index 3ded687bcf4a3..574d5577a2ccc 100644 --- a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs +++ b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs @@ -82,7 +82,7 @@ private Task DoSendPingCore(IPAddress address, byte[] buffer, int tim if (error == 0) { - error = Marshal.GetLastWin32Error(); + error = Marshal.GetLastPInvokeError(); // Only skip Async IO Pending error value. if (!isAsync || error != Interop.IpHlpApi.ERROR_IO_PENDING) diff --git a/src/libraries/System.Net.Primitives/src/System/Net/SocketException.Windows.cs b/src/libraries/System.Net.Primitives/src/System/Net/SocketException.Windows.cs index 6d81c8ef97fe6..8952b76109403 100644 --- a/src/libraries/System.Net.Primitives/src/System/Net/SocketException.Windows.cs +++ b/src/libraries/System.Net.Primitives/src/System/Net/SocketException.Windows.cs @@ -9,7 +9,7 @@ namespace System.Net.Sockets public partial class SocketException : Win32Exception { /// Creates a new instance of the class with the default error code. - public SocketException() : this(Marshal.GetLastWin32Error()) + public SocketException() : this(Marshal.GetLastPInvokeError()) { } diff --git a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Windows.cs b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Windows.cs index 093cd0719dd09..ca9494b3b023b 100644 --- a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Windows.cs +++ b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Windows.cs @@ -27,7 +27,7 @@ internal static SslPolicyErrors VerifyCertificateProperties( if (!chainBuildResult // Build failed on handle or on policy. && chain.SafeHandle!.DangerousGetHandle() == IntPtr.Zero) // Build failed to generate a valid handle. { - throw new CryptographicException(Marshal.GetLastWin32Error()); + throw new CryptographicException(Marshal.GetLastPInvokeError()); } if (checkCertName) diff --git a/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs b/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs index b2e2235641060..d21721fc25420 100644 --- a/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs +++ b/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs @@ -15,7 +15,7 @@ public sealed class WebSocketException : Win32Exception private readonly WebSocketError _webSocketErrorCode; public WebSocketException() - : this(Marshal.GetLastWin32Error()) + : this(Marshal.GetLastPInvokeError()) { } diff --git a/src/libraries/System.Net.WebSockets/tests/WebSocketExceptionTests.cs b/src/libraries/System.Net.WebSockets/tests/WebSocketExceptionTests.cs index 83204359bfd62..0d5e4d90490c1 100644 --- a/src/libraries/System.Net.WebSockets/tests/WebSocketExceptionTests.cs +++ b/src/libraries/System.Net.WebSockets/tests/WebSocketExceptionTests.cs @@ -34,7 +34,7 @@ public sealed partial class WebSocketExceptionTests [Fact] public void ConstructorTests_Parameterless_Success() { - int lastError = Marshal.GetLastWin32Error(); + int lastError = Marshal.GetLastPInvokeError(); var wse = new WebSocketException(); Assert.Equal(wse.NativeErrorCode, lastError); Assert.Equal(wse.ErrorCode, lastError); diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/PathHelper.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/PathHelper.Windows.cs index c51ea851d823b..377cde1305d74 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/PathHelper.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/PathHelper.Windows.cs @@ -83,11 +83,7 @@ private static void GetFullPathName(ReadOnlySpan path, ref ValueStringBuil if (result == 0) { // Failure, get the error and throw -#if NET6_0 - int errorCode = Marshal.GetLastPInvokeError(); -#else int errorCode = Marshal.GetLastWin32Error(); -#endif if (errorCode == 0) errorCode = Interop.Errors.ERROR_BAD_PATHNAME; throw Win32Marshal.GetExceptionForWin32Error(errorCode, path.ToString()); @@ -189,11 +185,7 @@ internal static string TryExpandShortFileName(ref ValueStringBuilder outputBuild if (result == 0) { // Look to see if we couldn't find the file -#if NET6_0 - int error = Marshal.GetLastPInvokeError(); -#else int error = Marshal.GetLastWin32Error(); -#endif if (error != Interop.Errors.ERROR_FILE_NOT_FOUND && error != Interop.Errors.ERROR_PATH_NOT_FOUND) { // Some other failure, give up diff --git a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs index 8415493fbf0e1..f027d6859a817 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs @@ -475,7 +475,7 @@ private void AssertDirectoryExists(string path) FileAttributes attributes = GetFileAttributesW(path); if (attributes == (FileAttributes)(-1)) { - int error = Marshal.GetLastWin32Error(); + int error = Marshal.GetLastPInvokeError(); Assert.False(true, $"error {error} getting attributes for {path}"); } diff --git a/src/libraries/System.Runtime.Handles/tests/SafeHandle.cs b/src/libraries/System.Runtime.Handles/tests/SafeHandle.cs index 4c663184d4d64..80d38992e6d66 100644 --- a/src/libraries/System.Runtime.Handles/tests/SafeHandle.cs +++ b/src/libraries/System.Runtime.Handles/tests/SafeHandle.cs @@ -113,7 +113,7 @@ public static void SafeHandle_DangerousReleasePreservesLastError() SetLastError(42); handle.DangerousRelease(); - int error = Marshal.GetLastWin32Error(); + int error = Marshal.GetLastPInvokeError(); Assert.Equal(42, error); } } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/LastErrorTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/LastErrorTests.cs index e16110f1a07a4..99a6b0b543898 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/LastErrorTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/LastErrorTests.cs @@ -28,7 +28,7 @@ public void SetLastPInvokeError_GetLastWin32Error() { int errorExpected = 123; Marshal.SetLastPInvokeError(errorExpected); - Assert.Equal(errorExpected, Marshal.GetLastWin32Error()); + Assert.Equal(errorExpected, Marshal.GetLastPInvokeError()); } [Fact] @@ -45,7 +45,7 @@ public void SetLastSystemError_PInvokeErrorUnchanged() Assert.NotEqual(systemError, pinvokeActual); Assert.Equal(pinvokeError, pinvokeActual); - int win32Actual = Marshal.GetLastWin32Error(); + int win32Actual = Marshal.GetLastPInvokeError(); Assert.NotEqual(systemError, win32Actual); Assert.Equal(pinvokeError, win32Actual); } diff --git a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs index 913d8397e9f3a..c78a1721c72a3 100644 --- a/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs +++ b/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs @@ -768,7 +768,7 @@ internal static SafeKeyHandle GetKeyPairHelper( /// returns the error code internal static int GetErrorCode() { - return Marshal.GetLastWin32Error(); + return Marshal.GetLastPInvokeError(); } /// diff --git a/src/libraries/System.Security.Cryptography.ProtectedData/System.Security.Cryptography.ProtectedData.sln b/src/libraries/System.Security.Cryptography.ProtectedData/System.Security.Cryptography.ProtectedData.sln index 0be65f24b8c9a..f405d1179d45d 100644 --- a/src/libraries/System.Security.Cryptography.ProtectedData/System.Security.Cryptography.ProtectedData.sln +++ b/src/libraries/System.Security.Cryptography.ProtectedData/System.Security.Cryptography.ProtectedData.sln @@ -23,9 +23,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{E71CB63B-6EB EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{60F975CB-2CC9-43E1-804B-9FB4142F49E8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Runtime.InteropServices", "..\System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj", "{C9FBEDE9-6A21-4696-8259-79C0B885BB79}" -EndProject Global + GlobalSection(NestedProjects) = preSolution + {21CC9F35-ACAA-4452-BE92-BBAE2E927B20} = {4BF33DE6-1FFA-4CC3-92DA-02A6931B89FD} + {3A6C62D5-EFCA-4119-BC60-C917533848A8} = {4BF33DE6-1FFA-4CC3-92DA-02A6931B89FD} + {4248C69F-DFF2-4E47-9749-E12D1312F5D5} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} + {179902DA-28E6-42F5-BA2D-905BEC68A32C} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} + {C25543F0-E445-45AF-809D-388DF6496520} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} + {E40DBC0E-386A-4B32-8DCE-9FE13EAD47BE} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} + {B3C3180D-31E8-4225-8A5D-6765945C9647} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} + {90042C2E-6AD9-4BFF-B7CA-8E6BF9B3D3C7} = {60F975CB-2CC9-43E1-804B-9FB4142F49E8} + {7773DB7A-494F-4508-9471-F737FDC7661E} = {60F975CB-2CC9-43E1-804B-9FB4142F49E8} + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -67,26 +76,10 @@ Global {B3C3180D-31E8-4225-8A5D-6765945C9647}.Debug|Any CPU.Build.0 = Debug|Any CPU {B3C3180D-31E8-4225-8A5D-6765945C9647}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3C3180D-31E8-4225-8A5D-6765945C9647}.Release|Any CPU.Build.0 = Release|Any CPU - {C9FBEDE9-6A21-4696-8259-79C0B885BB79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9FBEDE9-6A21-4696-8259-79C0B885BB79}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9FBEDE9-6A21-4696-8259-79C0B885BB79}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9FBEDE9-6A21-4696-8259-79C0B885BB79}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {21CC9F35-ACAA-4452-BE92-BBAE2E927B20} = {4BF33DE6-1FFA-4CC3-92DA-02A6931B89FD} - {4248C69F-DFF2-4E47-9749-E12D1312F5D5} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} - {179902DA-28E6-42F5-BA2D-905BEC68A32C} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} - {90042C2E-6AD9-4BFF-B7CA-8E6BF9B3D3C7} = {60F975CB-2CC9-43E1-804B-9FB4142F49E8} - {C25543F0-E445-45AF-809D-388DF6496520} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} - {E40DBC0E-386A-4B32-8DCE-9FE13EAD47BE} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} - {7773DB7A-494F-4508-9471-F737FDC7661E} = {60F975CB-2CC9-43E1-804B-9FB4142F49E8} - {3A6C62D5-EFCA-4119-BC60-C917533848A8} = {4BF33DE6-1FFA-4CC3-92DA-02A6931B89FD} - {B3C3180D-31E8-4225-8A5D-6765945C9647} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} - {C9FBEDE9-6A21-4696-8259-79C0B885BB79} = {E71CB63B-6EB0-473D-A2AE-487B7B280AB1} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FB101479-5EAB-495B-ACF3-4B6FC3F830EF} EndGlobalSection diff --git a/src/libraries/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj b/src/libraries/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj index 946ac31b8ace4..58751f8256471 100644 --- a/src/libraries/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj +++ b/src/libraries/System.Security.Cryptography.ProtectedData/src/System.Security.Cryptography.ProtectedData.csproj @@ -1,7 +1,7 @@ true - $(NetCoreAppCurrent);netstandard2.0-windows;net461-windows;netstandard2.0 + netstandard2.0-windows;net461-windows;netstandard2.0 enable @@ -39,7 +39,4 @@ - - - - + \ No newline at end of file diff --git a/src/libraries/System.Security.Cryptography.ProtectedData/src/System/Security/Cryptography/ProtectedData.cs b/src/libraries/System.Security.Cryptography.ProtectedData/src/System/Security/Cryptography/ProtectedData.cs index 4dfb1d9305b68..0e6b65bea1664 100644 --- a/src/libraries/System.Security.Cryptography.ProtectedData/src/System/Security/Cryptography/ProtectedData.cs +++ b/src/libraries/System.Security.Cryptography.ProtectedData/src/System/Security/Cryptography/ProtectedData.cs @@ -63,11 +63,7 @@ private static byte[] ProtectOrUnprotect(byte[] inputData, byte[]? optionalEntro Interop.Crypt32.CryptUnprotectData(ref userDataBlob, IntPtr.Zero, ref optionalEntropyBlob, IntPtr.Zero, IntPtr.Zero, flags, out outputBlob); if (!success) { -#if NET6_0 - int lastWin32Error = Marshal.GetLastPInvokeError(); -#else int lastWin32Error = Marshal.GetLastWin32Error(); -#endif if (protect && ErrorMayBeCausedByUnloadedProfile(lastWin32Error)) throw new CryptographicException(SR.Cryptography_DpApi_ProfileMayNotBeLoaded); else diff --git a/src/libraries/System.Text.Json/src/System.Text.Json.csproj b/src/libraries/System.Text.Json/src/System.Text.Json.csproj index 5d2d1eefbda6b..da3e843491517 100644 --- a/src/libraries/System.Text.Json/src/System.Text.Json.csproj +++ b/src/libraries/System.Text.Json/src/System.Text.Json.csproj @@ -1,4 +1,4 @@ - + true $(NetCoreAppCurrent);netstandard2.0;netcoreapp3.0;net461 diff --git a/src/libraries/System.Threading.Overlapped/tests/ThreadPoolBoundHandle_IntegrationTests.cs b/src/libraries/System.Threading.Overlapped/tests/ThreadPoolBoundHandle_IntegrationTests.cs index 85daba2b48e5a..008bf7aa2a571 100644 --- a/src/libraries/System.Threading.Overlapped/tests/ThreadPoolBoundHandle_IntegrationTests.cs +++ b/src/libraries/System.Threading.Overlapped/tests/ThreadPoolBoundHandle_IntegrationTests.cs @@ -32,7 +32,7 @@ public unsafe void SingleOperationOverSingleHandle() if (retval == 0) { - Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastWin32Error()); + Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastPInvokeError()); } // Wait for overlapped operation to complete @@ -77,7 +77,7 @@ public unsafe void MultipleOperationsOverSingleHandle() if (retval == 0) { - Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastWin32Error()); + Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastPInvokeError()); } @@ -87,7 +87,7 @@ public unsafe void MultipleOperationsOverSingleHandle() if (retval == 0) { - Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastWin32Error()); + Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastPInvokeError()); } // Wait for overlapped operations to complete @@ -142,7 +142,7 @@ public unsafe void MultipleOperationsOverMultipleHandles() if (retval == 0) { - Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastWin32Error()); + Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastPInvokeError()); } @@ -150,7 +150,7 @@ public unsafe void MultipleOperationsOverMultipleHandles() if (retval == 0) { - Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastWin32Error()); + Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastPInvokeError()); } // Wait for overlapped operations to complete @@ -209,7 +209,7 @@ public unsafe void FlowsAsyncLocalsToCallback() if (retval == 0) { - Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastWin32Error()); + Assert.Equal(DllImport.ERROR_IO_PENDING, Marshal.GetLastPInvokeError()); } // Wait for overlapped operation to complete