diff options
author | Aaron Robinson <arobins@microsoft.com> | 2018-12-13 14:36:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-13 14:36:24 -0800 |
commit | 9106f834c09638dfd081b71452268a511a45c5da (patch) | |
tree | 0021181e5f2d6e2095aa3a7418873099a4d06767 | |
parent | ac2b5f341330807c4442c0ad0e25efbabf863dec (diff) | |
download | coreclr-9106f834c09638dfd081b71452268a511a45c5da.tar.gz coreclr-9106f834c09638dfd081b71452268a511a45c5da.tar.bz2 coreclr-9106f834c09638dfd081b71452268a511a45c5da.zip |
Suppress warning of obsolete API (#21529)
5 files changed, 32 insertions, 131 deletions
diff --git a/tests/src/JIT/Methodical/structs/ExplicitLayout.cs b/tests/src/JIT/Methodical/structs/ExplicitLayout.cs index c1aa79cd54..c6b94f547b 100644 --- a/tests/src/JIT/Methodical/structs/ExplicitLayout.cs +++ b/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/tests/src/Loader/classloader/explicitlayout/Regressions/298006/explicitStruct_oddSize.cs b/tests/src/Loader/classloader/explicitlayout/Regressions/298006/explicitStruct_oddSize.cs index de4eca1a51..7af2e0e52d 100644 --- a/tests/src/Loader/classloader/explicitlayout/Regressions/298006/explicitStruct_oddSize.cs +++ b/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/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj b/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj deleted file mode 100644 index 79d45166fa..0000000000 --- a/tests/src/baseservices/exceptions/regressions/v4.0/706099/ManagedCom.csproj +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <OutputType>Library</OutputType> - <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <CLRTestKind>SharedLibrary</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - </PropertyGroup> - <ItemGroup> - <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> - <Visible>False</Visible> - </CodeAnalysisDependentAssemblyPaths> - </ItemGroup> - <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="managedcom.cs" /> - </ItemGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - </ItemGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> - <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> -</Project>
\ No newline at end of file diff --git a/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs b/tests/src/baseservices/exceptions/regressions/v4.0/706099/managedcom.cs deleted file mode 100644 index 5eefd5d0c1..0000000000 --- a/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/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs b/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs index d97f9c2d8e..1b814b7b21 100644 --- a/tests/src/baseservices/threading/commitstackonlyasneeded/StackCommitCommon.cs +++ b/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 |