Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElinor Fung <elfung@microsoft.com>2021-04-24 03:16:02 +0300
committerGitHub <noreply@github.com>2021-04-24 03:16:02 +0300
commit842956952e12361390ad92960b6124738500272a (patch)
tree2483a9e903ca4c36be01498ca03cbec030401a56 /src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop
parent59aa9c7d37cb3c12d34017918116c495b0fdc7ff (diff)
Rename MarshalEx.SetLastWin32Error -> SetLastPInvokeError (dotnet/runtimelab#1007)
Commit migrated from https://github.com/dotnet/runtimelab/commit/82735dd0fef4886ae2f0886267ef30822e17ee8a
Diffstat (limited to 'src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop')
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/MarshalEx.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/MarshalEx.cs b/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/MarshalEx.cs
index 8a53af07090..716dcf28eec 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/MarshalEx.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/MarshalEx.cs
@@ -23,9 +23,15 @@ namespace System.Runtime.InteropServices
/// <summary>
/// Set the last platform invoke error on the thread
/// </summary>
- public static void SetLastWin32Error(int error)
+ public static void SetLastPInvokeError(int error)
{
- typeof(Marshal).GetMethod("SetLastWin32Error", BindingFlags.NonPublic | BindingFlags.Static)!.Invoke(null, new object[] { error });
+ MethodInfo? method = typeof(Marshal).GetMethod("SetLastWin32Error", BindingFlags.NonPublic | BindingFlags.Static);
+ if (method == null)
+ {
+ method = typeof(Marshal).GetMethod("SetLastPInvokeError", BindingFlags.Public | BindingFlags.Static);
+ }
+
+ method!.Invoke(null, new object[] { error });
}
/// <summary>