From a9ede711dea223c4f37b19e384439ec7c7866b35 Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Mon, 28 Jun 2021 14:51:53 +0600 Subject: [PATCH 1/2] Remove IL2050 in System.Management Remove unused functions which trigger IL2050 As per discussed in #54317 --- .../src/ILLink/ILLink.Suppressions.xml | 26 +------------------ .../src/System.Management.csproj | 8 ------ 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/libraries/System.Management/src/ILLink/ILLink.Suppressions.xml b/src/libraries/System.Management/src/ILLink/ILLink.Suppressions.xml index 54f262023c9d42..fbf2a09e7eb939 100644 --- a/src/libraries/System.Management/src/ILLink/ILLink.Suppressions.xml +++ b/src/libraries/System.Management/src/ILLink/ILLink.Suppressions.xml @@ -31,29 +31,5 @@ member M:System.Management.MTAHelper.WorkerThread - - ILLink - IL2050 - member - M:Interop.Ole32.CoMarshalInterface(System.Runtime.InteropServices.ComTypes.IStream,System.Guid,System.IntPtr,System.UInt32,System.IntPtr,System.UInt32) - - - ILLink - IL2050 - member - M:Interop.Ole32.CoUnmarshalInterface(System.Runtime.InteropServices.ComTypes.IStream,System.Guid) - - - ILLink - IL2050 - member - M:Interop.Ole32.CreateStreamOnHGlobal(System.IntPtr,System.Boolean) - - - ILLink - IL2050 - member - M:Interop.Ole32.GetHGlobalFromStream(System.Runtime.InteropServices.ComTypes.IStream) - - \ No newline at end of file + diff --git a/src/libraries/System.Management/src/System.Management.csproj b/src/libraries/System.Management/src/System.Management.csproj index 9fac8892aed3ae..2d353115180a81 100644 --- a/src/libraries/System.Management/src/System.Management.csproj +++ b/src/libraries/System.Management/src/System.Management.csproj @@ -22,14 +22,6 @@ Link="Common\Interop\Windows\Kernel32\Interop.LoadLibrary.cs" /> - - - - From 54ea8a87a1c27411b86a8b4f52edb4df7803144f Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Mon, 28 Jun 2021 15:32:35 +0600 Subject: [PATCH 2/2] Fix location of variables --- .../src/Interop/Windows/Ole32/Interop.CoGetObjectContext.cs | 4 ++-- .../Interop/Windows/Ole32/Interop.CreateStreamOnHGlobal.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetObjectContext.cs b/src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetObjectContext.cs index 4326327034382d..c73b065ea59537 100644 --- a/src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetObjectContext.cs +++ b/src/libraries/Common/src/Interop/Windows/Ole32/Interop.CoGetObjectContext.cs @@ -9,7 +9,7 @@ internal static partial class Interop { internal static partial class Ole32 { - [DllImport(Libraries.Ole32, PreserveSig = false)] - internal static extern IStream CreateStreamOnHGlobal(IntPtr hGlobal, bool fDeleteOnRelease); + [DllImport(Libraries.Ole32)] + internal static extern int CoGetObjectContext([MarshalAs(UnmanagedType.LPStruct)] Guid riid, out IntPtr ppv); } } diff --git a/src/libraries/Common/src/Interop/Windows/Ole32/Interop.CreateStreamOnHGlobal.cs b/src/libraries/Common/src/Interop/Windows/Ole32/Interop.CreateStreamOnHGlobal.cs index 1b153d786dfbae..d65814a2f51c6b 100644 --- a/src/libraries/Common/src/Interop/Windows/Ole32/Interop.CreateStreamOnHGlobal.cs +++ b/src/libraries/Common/src/Interop/Windows/Ole32/Interop.CreateStreamOnHGlobal.cs @@ -8,7 +8,7 @@ internal static partial class Interop { internal static partial class Ole32 { - [DllImport(Libraries.Ole32)] - internal static extern int CoGetObjectContext([MarshalAs(UnmanagedType.LPStruct)] Guid riid, out IntPtr ppv); + [DllImport(Libraries.Ole32, PreserveSig = false)] + internal static extern IStream CreateStreamOnHGlobal(IntPtr hGlobal, bool fDeleteOnRelease); } }