From e62de6b275f9a5e798c209cc900bc4007d295e3a Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 13 Dec 2018 14:36:24 -0800 Subject: [PATCH] Suppress warning of obsolete API (dotnet/coreclr#21529) Commit migrated from https://github.com/dotnet/coreclr/commit/9106f834c09638dfd081b71452268a511a45c5da --- .../src/JIT/Methodical/structs/ExplicitLayout.cs | 2 + .../Regressions/298006/explicitStruct_oddSize.cs | 57 ++++++++++---------- .../regressions/v4.0/706099/ManagedCom.csproj | 39 -------------- .../regressions/v4.0/706099/managedcom.cs | 62 ---------------------- .../commitstackonlyasneeded/StackCommitCommon.cs | 3 +- 5 files changed, 32 insertions(+), 131 deletions(-) delete mode 100644 src/coreclr/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj delete mode 100644 src/coreclr/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs diff --git a/src/coreclr/tests/src/JIT/Methodical/structs/ExplicitLayout.cs b/src/coreclr/tests/src/JIT/Methodical/structs/ExplicitLayout.cs index c1aa79c..c6b94f5 100644 --- a/src/coreclr/tests/src/JIT/Methodical/structs/ExplicitLayout.cs +++ b/src/coreclr/tests/src/JIT/Methodical/structs/ExplicitLayout.cs @@ -9,6 +9,7 @@ using System.Runtime.InteropServices; class ExplicitLayout { +#pragma warning disable 618 [StructLayout(LayoutKind.Explicit, Size = SIZE)] internal unsafe struct TestStruct { @@ -23,6 +24,7 @@ class ExplicitLayout [FieldOffset(16), MarshalAs(UnmanagedType.Struct, SizeConst = 16)] public Guid Guid2; } +#pragma warning restore 618 internal class Program { diff --git a/src/coreclr/tests/src/Loader/classloader/explicitlayout/Regressions/298006/explicitStruct_oddSize.cs b/src/coreclr/tests/src/Loader/classloader/explicitlayout/Regressions/298006/explicitStruct_oddSize.cs index de4eca1..7af2e0e 100644 --- a/src/coreclr/tests/src/Loader/classloader/explicitlayout/Regressions/298006/explicitStruct_oddSize.cs +++ b/src/coreclr/tests/src/Loader/classloader/explicitlayout/Regressions/298006/explicitStruct_oddSize.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// This test is a regression test for VSWhidbey 298006 // The struct has an objref and is of odd size. // The GC requires that all valuetypes containing objrefs be sized to a multiple of sizeof(void*) )== 4). // Since the size of this struct was 17 we were throwing a TypeLoadException. @@ -10,6 +9,7 @@ using System; using System.Runtime.InteropServices; +#pragma warning disable 618 [StructLayout(LayoutKind.Explicit)] public struct S { @@ -17,36 +17,35 @@ public struct S [FieldOffset(8)] public double d; [FieldOffset(0), MarshalAs(UnmanagedType.BStr)] public string st; } - - +#pragma warning restore 618 public class Test { - public static void Run() - { - S s; - s.b = true; - } - - public static int Main() - { - try - { - Run(); - - Console.WriteLine("PASS"); - return 100; - } - catch (TypeLoadException e) - { - Console.WriteLine("FAIL: Caught unexpected TypeLoadException: {0}", e.Message); - return 101; - } - catch (Exception e) - { - Console.WriteLine("FAIL: Caught unexpected Exception: {0}", e.Message); - return 101; - } - } + public static void Run() + { + S s; + s.b = true; + } + + public static int Main() + { + try + { + Run(); + + Console.WriteLine("PASS"); + return 100; + } + catch (TypeLoadException e) + { + Console.WriteLine("FAIL: Caught unexpected TypeLoadException: {0}", e.Message); + return 101; + } + catch (Exception e) + { + Console.WriteLine("FAIL: Caught unexpected Exception: {0}", e.Message); + return 101; + } + } } diff --git a/src/coreclr/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj b/src/coreclr/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj deleted file mode 100644 index 79d4516..0000000 --- a/src/coreclr/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Debug - AnyCPU - 2.0 - {95DFC527-4DC1-495E-97D7-E94EE1F7140D} - Library - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - ..\..\ - true - SharedLibrary - 1 - - - - - - - - - False - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/coreclr/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs b/src/coreclr/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs deleted file mode 100644 index 5eefd5d..0000000 --- a/src/coreclr/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -using System; -using System.Runtime.InteropServices; - -[ComVisible(true)] -[ClassInterface(ClassInterfaceType.AutoDual)] -[Guid("2A9F41BC-94F4-4889-9F8A-E0290CEF1177")] -public class Class1COMInterop -{ - public delegate void Callback(); - - [DllImport("NativePinvoke", CallingConvention=CallingConvention.StdCall)] - public static extern void Native2(Callback call); - - [DispId(1)] - public void Managed1() - { - Console.WriteLine("Inside Managed1"); - try - { - Managed2(); - } - finally - { - try - { - throw new ArgumentException(); - } - catch(ArgumentException e) - { - Console.WriteLine("Managed1: Caught Exception: " + e); - } - } - } - - public static void Managed2() - { - Console.WriteLine("Inside Managed2"); - - // pinvoke into Native2 - Native2( new Callback(Managed3) ); - - } - - public static void Managed3() - { - Console.WriteLine("Inside Managed3()"); - Managed4(); - } - - public static void Managed4() - { - - Console.WriteLine("Inside Managed4()"); - - // Throw IndexOutOfBounds - int[] IntArray = new int[10]; - IntArray[11] = 5; - } -} \ No newline at end of file diff --git a/src/coreclr/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs b/src/coreclr/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs index d97f9c2..1b814b7 100644 --- a/src/coreclr/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs +++ b/src/coreclr/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs @@ -7,14 +7,15 @@ using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Threading; -//using System.Configuration; namespace StackCommitTest { public unsafe class WinApi { +#pragma warning disable 618 [DllImport("kernel32.dll")] public static extern void GetSystemInfo([MarshalAs(UnmanagedType.Struct)] ref SYSTEM_INFO lpSystemInfo); +#pragma warning restore 618 [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO -- 2.7.4