From ea98607f8e0c24d91703c157ee80acd67ca6686d Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Wed, 3 Aug 2016 22:03:53 -0700 Subject: [PATCH] Fix warnings in interop tests and disable IsComObject(null) scenario as it is failing in non-Windows Commit migrated from https://github.com/dotnet/coreclr/commit/c71a30805870a7e34d82445d59a0ab536232e383 --- .../GetNativeVariantForObject.csproj | 1 + .../Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs | 13 ++++++------- .../MarshalAPI/Miscellaneous/MarshalClassTests.csproj | 1 + .../tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj | 1 + .../UnsafeAddrOfPinnedArrayElement.csproj | 1 + 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/coreclr/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.csproj b/src/coreclr/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.csproj index c473780..8d1987a 100644 --- a/src/coreclr/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.csproj +++ b/src/coreclr/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.csproj @@ -16,6 +16,7 @@ 7a9bfb7d $(DefineConstants);STATIC + 0618;0649 diff --git a/src/coreclr/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs b/src/coreclr/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs index 7e65a31..b184020 100644 --- a/src/coreclr/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs +++ b/src/coreclr/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs @@ -56,9 +56,7 @@ class MarshalClassTests int retVal = 100; IntPtr ip; - Object o; SomeTestStruct someTs = new SomeTestStruct(); - StructWithFxdLPSTRSAFld someTs_FxdLPSTR = new StructWithFxdLPSTRSAFld(); #if BUG_876976 Console.WriteLine("Testing SizeOf..."); @@ -308,7 +306,7 @@ class MarshalClassTests Console.WriteLine("\n\tPassing structure that has no layout and CANNOT be marshaled"); try { - Marshal.SizeOf(someTs_FxdLPSTR.GetType()); + Marshal.SizeOf(typeof(StructWithFxdLPSTRSAFld)); retVal = 0; Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!"); } @@ -371,7 +369,7 @@ class MarshalClassTests Console.WriteLine("\n\tPassing structure that has no layout and CANNOT be marshaled"); try { - Marshal.OffsetOf(someTs_FxdLPSTR.GetType(), "Arr"); + Marshal.OffsetOf(typeof(StructWithFxdLPSTRSAFld), "Arr"); retVal = 0; Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!"); } @@ -493,6 +491,7 @@ class MarshalClassTests Console.WriteLine("DONE testing Copy."); +#if ISSUE_6605 ////////////////////////////////////////////////////////////// //IsComObject ///////////////////////////////////////////////////////////// @@ -513,9 +512,9 @@ class MarshalClassTests retVal = 0; Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString()); } - +#endif Console.WriteLine("DONE testing IsComObject."); - return 100; + return retVal; } -} \ No newline at end of file +} diff --git a/src/coreclr/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.csproj b/src/coreclr/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.csproj index b1f8120..0a01282 100644 --- a/src/coreclr/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.csproj +++ b/src/coreclr/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.csproj @@ -16,6 +16,7 @@ 7a9bfb7d $(DefineConstants);STATIC + 0618;0649 diff --git a/src/coreclr/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj b/src/coreclr/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj index 89a27da..4eb1473 100644 --- a/src/coreclr/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj +++ b/src/coreclr/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj @@ -16,6 +16,7 @@ 7a9bfb7d $(DefineConstants);STATIC + 0618;0649;0169 diff --git a/src/coreclr/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.csproj b/src/coreclr/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.csproj index 9ebc16d..5f1140e 100644 --- a/src/coreclr/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.csproj +++ b/src/coreclr/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.csproj @@ -16,6 +16,7 @@ 7a9bfb7d $(DefineConstants);STATIC + 0618 -- 2.7.4