diff --git a/src/libraries/System.Runtime/tests/System/ActivatorTests.cs b/src/libraries/System.Runtime/tests/System/ActivatorTests.cs index 3833e79305f25..b65b9b43ec624 100644 --- a/src/libraries/System.Runtime/tests/System/ActivatorTests.cs +++ b/src/libraries/System.Runtime/tests/System/ActivatorTests.cs @@ -198,6 +198,13 @@ public static IEnumerable CreateInstance_NoDefaultConstructor_TestData yield return new object[] { typeof(int[]) }; yield return new object[] { typeof(int).MakeByRefType() }; yield return new object[] { typeof(int).MakePointerType() }; + + // https://github.com/dotnet/runtime/issues/71095 + if (!PlatformDetection.IsMonoRuntime) + { + yield return new object[] { FunctionPointerType() }; + static unsafe Type FunctionPointerType() => typeof(delegate*); + } } [Theory] diff --git a/src/libraries/System.Runtime/tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs b/src/libraries/System.Runtime/tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs index 12112f88e7718..5568a5f62eb17 100644 --- a/src/libraries/System.Runtime/tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs +++ b/src/libraries/System.Runtime/tests/System/Runtime/CompilerServices/RuntimeHelpersTests.cs @@ -203,8 +203,6 @@ private static void FillStack(int depth) public static IEnumerable GetUninitializedObject_NegativeTestCases() { - // TODO: Test actual function pointer types when typeof(delegate*<...>) support is available - yield return new[] { typeof(string), typeof(ArgumentException) }; // variable-length type yield return new[] { typeof(int[]), typeof(ArgumentException) }; // variable-length type yield return new[] { typeof(int[,]), typeof(ArgumentException) }; // variable-length type @@ -227,11 +225,18 @@ public static IEnumerable GetUninitializedObject_NegativeTestCases() yield return new[] { typeof(Delegate), typeof(MemberAccessException) }; // abstract type yield return new[] { typeof(void), typeof(ArgumentException) }; // explicit block in place - yield return new[] { typeof(int).MakePointerType(), typeof(ArgumentException) }; // pointer typedesc - yield return new[] { typeof(int).MakeByRefType(), typeof(ArgumentException) }; // byref typedesc + yield return new[] { typeof(int).MakePointerType(), typeof(ArgumentException) }; // pointer + yield return new[] { typeof(int).MakeByRefType(), typeof(ArgumentException) }; // byref + + // https://github.com/dotnet/runtime/issues/71095 + if (!PlatformDetection.IsMonoRuntime) + { + yield return new[] { FunctionPointerType(), typeof(ArgumentException) }; // function pointer + static unsafe Type FunctionPointerType() => typeof(delegate*); + } - yield return new[] { typeof(ReadOnlySpan), typeof(NotSupportedException) }; // byref type - yield return new[] { typeof(ArgIterator), typeof(NotSupportedException) }; // byref type + yield return new[] { typeof(ReadOnlySpan), typeof(NotSupportedException) }; // byref-like type + yield return new[] { typeof(ArgIterator), typeof(NotSupportedException) }; // byref-like type Type canonType = typeof(object).Assembly.GetType("System.__Canon", throwOnError: false); if (canonType != null)