Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/libraries/System.Runtime.InteropServices/tests')
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/NativeMarshallingAttributeAnalyzerTests.cs10
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj1
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/IDispatchImplAttributeTests.cs27
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/AddRefTests.cs1
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/DestroyStructureTests.cs2
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionCodeTests.cs2
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionForHRTests.cs1
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionPointersTests.cs3
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs4
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs6
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PrelinkTests.cs2
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PtrToStructureTests.cs3
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs2
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReleaseTests.cs1
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/SizeOfTests.cs4
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs3
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ThrowExceptionForHRTests.cs1
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs1
-rw-r--r--src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj11
19 files changed, 49 insertions, 36 deletions
diff --git a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/NativeMarshallingAttributeAnalyzerTests.cs b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/NativeMarshallingAttributeAnalyzerTests.cs
index 58256871872..5b8769e19c9 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/NativeMarshallingAttributeAnalyzerTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/NativeMarshallingAttributeAnalyzerTests.cs
@@ -272,8 +272,18 @@ namespace LibraryImportGenerator.UnitTests
{
void Foo([MarshalAs(UnmanagedType.I4)] int i)
{
+ [return:MarshalAs(UnmanagedType.I4)]
+ [SkipLocalsInit]
+ static int Local()
+ {
+ return 0;
+ }
}
}
+
+ [return:MarshalAs(UnmanagedType.I4)]
+ delegate int Y();
+
""";
await VerifyCS.VerifyAnalyzerAsync(source);
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj
index 34964fb33f2..867c373eea2 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System.Runtime.InteropServices.Tests.csproj
@@ -44,7 +44,6 @@
<Compile Include="System\Runtime\InteropServices\GuidAttributeTests.cs" />
<Compile Include="System\Runtime\InteropServices\HandleCollectorTests.cs" />
<Compile Include="System\Runtime\InteropServices\HandleRefTests.cs" />
- <Compile Include="System\Runtime\InteropServices\IDispatchImplAttributeTests.cs" />
<Compile Include="System\Runtime\InteropServices\InterfaceTypeAttributeTests.cs" />
<Compile Include="System\Runtime\InteropServices\LCIDConversionAttributeTests.cs" />
<Compile Include="System\Runtime\InteropServices\LibraryImportAttributeTests.cs" />
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/IDispatchImplAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/IDispatchImplAttributeTests.cs
deleted file mode 100644
index ac192126f64..00000000000
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/IDispatchImplAttributeTests.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Reflection;
-using Xunit;
-
-namespace System.Runtime.InteropServices.Tests
-{
- public class IDispatchImplAttributeTests
- {
- [Theory]
- [InlineData(-1)]
- [InlineData(0)]
- [InlineData(2)]
- public void Ctor_ImplTypeShort(short implType)
- {
- Type type = Type.GetType("System.Runtime.InteropServices.IDispatchImplAttribute, System.Runtime.InteropServices");
- PropertyInfo valueProperty = type.GetProperty("Value");
- Assert.NotNull(type);
- Assert.NotNull(valueProperty);
-
- ConstructorInfo shortConstructor = type.GetConstructor(new Type[] { typeof(short) });
- object attribute = shortConstructor.Invoke(new object[] { implType });
- Assert.Equal(implType, (int)valueProperty.GetValue(attribute));
- }
- }
-}
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/AddRefTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/AddRefTests.cs
index ec5ae351bc7..ee1772a78d6 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/AddRefTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/AddRefTests.cs
@@ -10,6 +10,7 @@ namespace System.Runtime.InteropServices.Tests
{
[Fact]
[SkipOnMono("ComWrappers are not supported on Mono")]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/76005", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot), nameof(PlatformDetection.IsNotWindows))]
public void AddRef_ValidPointer_Success()
{
var cw = new ComWrappersImpl();
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/DestroyStructureTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/DestroyStructureTests.cs
index 17a737da414..66fa0edb4a2 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/DestroyStructureTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/DestroyStructureTests.cs
@@ -94,6 +94,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Theory]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[ActiveIssue("https://github.com/mono/mono/issues/15087", TestRuntimes.Mono)]
[MemberData(nameof(DestroyStructure_InvalidType_TestData))]
public void DestroyStructure_NonRuntimeType_ThrowsArgumentException(Type invalidType)
@@ -102,6 +103,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void DestroyStructure_AutoLayout_ThrowsArgumentException()
{
AssertExtensions.Throws<ArgumentException>("structureType", () => Marshal.DestroyStructure<AutoLayoutStruct>((IntPtr)1));
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionCodeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionCodeTests.cs
index 098a246313f..e5448eee839 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionCodeTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionCodeTests.cs
@@ -7,7 +7,7 @@ using Xunit;
namespace System.Runtime.InteropServices.Tests
{
- [SkipOnMono("Marshal.GetExceptionCode will not be implemented in Mono, see https://github.com/mono/mono/issues/15085.")]
+ [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsMarshalGetExceptionPointersSupported))]
public class GetExceptionCodeTests
{
[Fact]
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionForHRTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionForHRTests.cs
index 631939e769c..b0928d193c3 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionForHRTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionForHRTests.cs
@@ -6,6 +6,7 @@ using Xunit;
namespace System.Runtime.InteropServices.Tests
{
+ [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public class GetExceptionForHRTests
{
[Theory]
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionPointersTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionPointersTests.cs
index 3ee0eb115d6..dd8d72df0c6 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionPointersTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetExceptionPointersTests.cs
@@ -7,8 +7,7 @@ namespace System.Runtime.InteropServices.Tests
{
public class GetExceptionPointersTests
{
- [Fact]
- [SkipOnMono("Marshal.GetExceptionPointers will not be implemented in Mono, see https://github.com/mono/mono/issues/15085.")]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsMarshalGetExceptionPointersSupported))]
public void GetExceptionPointers_ReturnsExpected()
{
Assert.Equal(IntPtr.Zero, Marshal.GetExceptionPointers());
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs
index f6ce9be0b8b..79c3adb3c91 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs
@@ -106,6 +106,10 @@ namespace System.Runtime.InteropServices.Tests
[SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser.")]
public void GetFunctionPointerForDelegate_MarshalledClosedStaticDelegate()
{
+ // Ensure AOT compilers see the delegate being used with interop
+ if (string.Empty.Length > 0)
+ Marshal.GetFunctionPointerForDelegate<NoArgsDelegate>(null);
+
MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static);
Delegate original = targetMethod.CreateDelegate(typeof(NoArgsDelegate), "value");
IntPtr ptr = Marshal.GetFunctionPointerForDelegate(original);
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs
index 2221e887354..1f0a416c3d5 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/OffsetOfTests.cs
@@ -213,10 +213,15 @@ namespace System.Runtime.InteropServices.Tests
public static IEnumerable<object[]> OffsetOf_NotMarshallable_TestData()
{
+ // Ensure AOT compilers generate the marshalling data
+ if (string.Empty.Length > 0)
+ Marshal.SizeOf<StructWithFxdLPSTRSAFld>();
+
yield return new object[] { typeof(StructWithFxdLPSTRSAFld), nameof(StructWithFxdLPSTRSAFld.Arr) };
}
[Theory]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[ActiveIssue("https://github.com/mono/mono/issues/15087", TestRuntimes.Mono)]
[MemberData(nameof(OffsetOf_NotMarshallable_TestData))]
public void OffsetOf_NotMarshallable_ThrowsArgumentException(Type t, string fieldName)
@@ -225,6 +230,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void OffsetOf_NoLayoutPoint_ThrowsArgumentException()
{
AssertExtensions.Throws<ArgumentException>(null, () => Marshal.OffsetOf(typeof(NoLayoutPoint), nameof(NoLayoutPoint.x)));
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PrelinkTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PrelinkTests.cs
index febdeffd0e1..f30d7cd64cb 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PrelinkTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PrelinkTests.cs
@@ -31,7 +31,7 @@ namespace System.Runtime.InteropServices.Tests
AssertExtensions.Throws<ArgumentNullException>("m", () => Marshal.Prelink(null));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public void Prelink_NonRuntimeMethod_ThrowsArgumentException()
{
AssertExtensions.Throws<ArgumentException>("m", null, () => Marshal.Prelink(new NonRuntimeMethodInfo()));
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PtrToStructureTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PtrToStructureTests.cs
index 9678dab54f9..97f6a4efb96 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PtrToStructureTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/PtrToStructureTests.cs
@@ -139,6 +139,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void PtrToStructure_AutoLayoutClass_ThrowsArgumentException()
{
AssertExtensions.Throws<ArgumentException>("structure", () => Marshal.PtrToStructure((IntPtr)1, (object)new NonGenericClass()));
@@ -186,6 +187,7 @@ namespace System.Runtime.InteropServices.Tests
[Theory]
[MemberData(nameof(PtrToStructure_ObjectNotBlittable_TestData))]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void PtrToStructure_ObjectNoBlittable_ThrowsArgumentException(object structure)
{
AssertExtensions.Throws<ArgumentException>("structure", () => Marshal.PtrToStructure((IntPtr)1, structure));
@@ -232,6 +234,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Theory]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[MemberData(nameof(PtrToStructure_NonBlittableType_TestData))]
public void PtrToStructure_NonBlittablType_ThrowsArgumentException(Type structureType)
{
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs
index 7d1db477dd9..41838ed5b95 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs
@@ -22,6 +22,7 @@ namespace System.Runtime.InteropServices.Tests
[Theory]
[MemberData(nameof(QueryInterface_ValidInterface_TestData))]
[SkipOnMono("ComWrappers are not supported on Mono")]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/76005", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot), nameof(PlatformDetection.IsNotWindows))]
public void QueryInterface_ValidInterface_Success(object o, string iidString)
{
var cw = new ComWrappersImpl();
@@ -55,6 +56,7 @@ namespace System.Runtime.InteropServices.Tests
[Theory]
[MemberData(nameof(QueryInterface_NoSuchInterface_TestData))]
[SkipOnMono("ComWrappers are not supported on Mono")]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/76005", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot), nameof(PlatformDetection.IsNotWindows))]
public void QueryInterface_NoSuchInterface_Success(object o, string iidString)
{
var cw = new ComWrappersImpl();
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReleaseTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReleaseTests.cs
index 3ef69cfc092..087318aa642 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReleaseTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ReleaseTests.cs
@@ -10,6 +10,7 @@ namespace System.Runtime.InteropServices.Tests
{
[Fact]
[SkipOnMono("ComWrappers are not supported on Mono")]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/76005", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot), nameof(PlatformDetection.IsNotWindows))]
public void Release_ValidPointer_Success()
{
var cw = new ComWrappersImpl();
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/SizeOfTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/SizeOfTests.cs
index ae7cf0f84da..2d0c0b2b93d 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/SizeOfTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/SizeOfTests.cs
@@ -28,8 +28,7 @@ namespace System.Runtime.InteropServices.Tests
[Fact]
public void SizeOf_Object_ReturnsExpected()
{
- SomeTestStruct someTestStruct = new SomeTestStruct();
- Assert.NotEqual(0, Marshal.SizeOf(someTestStruct.GetType()));
+ Assert.NotEqual(0, Marshal.SizeOf(typeof(SomeTestStruct)));
}
[Fact]
@@ -91,6 +90,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Theory]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[ActiveIssue("https://github.com/mono/mono/issues/15087", TestRuntimes.Mono)]
[MemberData(nameof(SizeOf_InvalidType_TestData))]
public void SizeOf_InvalidType_ThrowsArgumentException(Type type, string paramName)
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs
index 61acb05db5e..59cefc137ce 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/StructureToPtrTests.cs
@@ -150,6 +150,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Theory]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[MemberData(nameof(StructureToPtr_NonBlittableObject_TestData))]
public void StructureToPtr_NonBlittable_ThrowsArgumentException(object o)
{
@@ -158,6 +159,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
public void StructureToPtr_AutoLayout_ThrowsArgumentException()
{
var someTs_Auto = new SomeTestStruct_Auto();
@@ -166,6 +168,7 @@ namespace System.Runtime.InteropServices.Tests
}
[Fact]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/75666", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[ActiveIssue("https://github.com/mono/mono/issues/15104", TestRuntimes.Mono)]
public void StructureToPtr_InvalidLengthByValArrayInStruct_ThrowsArgumentException()
{
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ThrowExceptionForHRTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ThrowExceptionForHRTests.cs
index 346da6f4250..c364da559b2 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ThrowExceptionForHRTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/ThrowExceptionForHRTests.cs
@@ -7,6 +7,7 @@ using Xunit;
namespace System.Runtime.InteropServices.Tests
{
+ [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public class ThrowExceptionForHRTests
{
[Theory]
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs
index 6c45152e8fe..1493fc255bf 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs
@@ -16,6 +16,7 @@ namespace System.Runtime.InteropServices.Tests
{
[PlatformSpecific(TestPlatforms.OSX)]
[SkipOnMono("Not currently implemented on Mono")]
+ [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))] // https://github.com/dotnet/runtimelab/issues/155
public unsafe class MessageSendTests
{
private static int s_count = 1;
diff --git a/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj b/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj
index d420161d1a6..fcf18ce41ef 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj
+++ b/src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj
@@ -9,7 +9,7 @@
<DnneGenRollForward>Major</DnneGenRollForward>
<!-- To integrate with DNNE's architecture calculation, we need to set the RID for this project. -->
<RuntimeIdentifier>$(OutputRid)</RuntimeIdentifier>
- <AppHostRuntimeIdentifier>$(OutputRid)</AppHostRuntimeIdentifier>
+ <AppHostRuntimeIdentifier>$(PackageRID)</AppHostRuntimeIdentifier>
<_TargetsAppleOS Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'MacCatalyst' or
'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'iOSSimulator' or
'$(TargetOS)' == 'tvOSSimulator'">true</_TargetsAppleOS>
@@ -35,6 +35,13 @@
StandardOutputImportance="Low">
<Output TaskParameter="ConsoleOutput" PropertyName="DnneCompilerCommand" />
</Exec>
+
+ <Exec Command="bash -c 'source &quot;$(RepositoryEngineeringDir)/common/native/init-compiler.sh&quot; &quot;$(RepositoryEngineeringDir)/common/native&quot; $(TargetArchitecture) $(NativeCompiler) &amp;&amp; echo $LDFLAGS' 2>/dev/null"
+ EchoOff="true"
+ ConsoleToMsBuild="true"
+ StandardOutputImportance="Low">
+ <Output TaskParameter="ConsoleOutput" PropertyName="DnneLinkerCommand" />
+ </Exec>
</Target>
<Target Name="GetUnixCrossBuildArgumentsForDNNE"
@@ -61,7 +68,7 @@
<PropertyGroup>
<CommonToolchainArgs>--target=$(TargetTriple) --gcc-toolchain=$(ROOTFS_DIR)/usr --sysroot=$(ROOTFS_DIR)</CommonToolchainArgs>
- <DnneLinkerUserFlags>$(CommonToolchainArgs) $(DnneLinkerUserFlags.Replace(';',' '))</DnneLinkerUserFlags>
+ <DnneLinkerUserFlags>$(CommonToolchainArgs) $(DnneLinkerCommand) $(DnneLinkerUserFlags.Replace(';',' '))</DnneLinkerUserFlags>
<DnneCompilerUserFlags>$(CommonToolchainArgs) $(DnneCompilerUserFlags.Replace(';',' '))</DnneCompilerUserFlags>
</PropertyGroup>
</Target>