From 00b9f84f55b60b37ae0b9bacb325b9865f72a65f Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Thu, 13 May 2021 19:22:40 -0700 Subject: [PATCH] Convert System.Runtime.InteropServices.RuntimeInformation --- .../src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs | 4 ++-- .../Interop/Windows/Kernel32/Interop.GetNativeSystemInfo.cs | 4 ++-- .../src/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs | 4 ++-- .../System.Runtime.InteropServices.RuntimeInformation.csproj | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs index 75854552fa3d5..3c130da95f54d 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs @@ -10,8 +10,8 @@ internal static partial class Interop { internal static partial class Sys { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixVersion", CharSet = CharSet.Ansi, SetLastError = true)] - private static extern int GetUnixVersion(byte[] version, ref int capacity); + [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixVersion", CharSet = CharSet.Ansi, SetLastError = true)] + private static partial int GetUnixVersion(byte[] version, ref int capacity); internal static string GetUnixVersion() { diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetNativeSystemInfo.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetNativeSystemInfo.cs index 60bbcca66c548..a553f539c2398 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetNativeSystemInfo.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetNativeSystemInfo.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class Kernel32 { - [DllImport(Libraries.Kernel32)] - internal static extern void GetNativeSystemInfo(out SYSTEM_INFO lpSystemInfo); + [GeneratedDllImport(Libraries.Kernel32)] + internal static partial void GetNativeSystemInfo(out SYSTEM_INFO lpSystemInfo); } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs index 48e4b23dfcc3d..8e399fb8e0439 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs @@ -7,7 +7,7 @@ internal static partial class Interop { internal static partial class Kernel32 { - [DllImport(Libraries.Kernel32)] - internal static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo); + [GeneratedDllImport(Libraries.Kernel32)] + internal static partial void GetSystemInfo(out SYSTEM_INFO lpSystemInfo); } } diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj index 2ee0caf2d562f..e143498080333 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj @@ -38,6 +38,7 @@ Link="Common\Interop\Windows\Kernel32\Interop.GetSystemInfo.cs" /> +