diff options
author | Tijoy Tom Kalathiparambil <tijoytk@microsoft.com> | 2017-06-10 01:11:19 +0300 |
---|---|---|
committer | Tijoy Tom Kalathiparambil <tijoytk@microsoft.com> | 2017-06-10 01:11:19 +0300 |
commit | 207613a584a186f42dbd7e2f3f3555b782f25c20 (patch) | |
tree | 40a1bd124f58cdc3af730fcf7f8af5b661283c08 | |
parent | 83620216d19f4a8c02c6df4833d5075830978510 (diff) |
UnmanagedFunctionPointer Attribute
We were handling only CallingConvension from UnmanagedFuncPointerAttrbiutes , but the networking team hit an issue where they were relaying on SetLastError on by default. This change implement SetLastError , but it's not on by default as in CoreCLR/Desktop. Now we read and store all the attributes from UnmanagedFunctionPointer but only CallingConvesion and SetLastError are handled.
Change also include a fix for DllImport SetLastError whihc was not clearing the error before setting it.
[tfs-changeset: 1661289]
3 files changed, 7 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Unix.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Unix.cs index 41dae2a3a..f9e07a395 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Unix.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Unix.cs @@ -18,7 +18,7 @@ namespace System.Runtime.InteropServices s_lastWin32Error = Interop.Sys.GetErrNo(); } - internal static void ClearLastWin32Error() + public static void ClearLastWin32Error() { Interop.Sys.ClearErrNo(); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs index 999b516e2..3bb267361 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/PInvokeMarshal.Windows.cs @@ -38,7 +38,7 @@ namespace System.Runtime.InteropServices s_lastWin32Error = Interop.mincore.GetLastError(); } - internal static void ClearLastWin32Error() + public static void ClearLastWin32Error() { Interop.mincore.SetLastError(0); } diff --git a/src/System.Private.Interop/src/Shared/McgMarshal.cs b/src/System.Private.Interop/src/Shared/McgMarshal.cs index 11315c7a4..9577a33d2 100644 --- a/src/System.Private.Interop/src/Shared/McgMarshal.cs +++ b/src/System.Private.Interop/src/Shared/McgMarshal.cs @@ -49,6 +49,11 @@ namespace System.Runtime.InteropServices PInvokeMarshal.SaveLastWin32Error(); } + public static void ClearLastWin32Error() + { + PInvokeMarshal.ClearLastWin32Error(); + } + public static bool GuidEquals(ref Guid left, ref Guid right) { return InteropExtensions.GuidEquals(ref left, ref right); |