Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] Attempt to enable test #89498

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 25 additions & 28 deletions src/libraries/System.Runtime/tests/System/TypedReferenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,34 +78,31 @@ public static void MakeTypedReference_ToObjectTests()
Assert.Equal(structObj, TypedReference.ToObject(reference));
}

// These tests are currently crashing the Mono AOT compiler, so commenting them out (skipping them isn't enough)
//[Fact]
//[ActiveIssue("https://github.com/dotnet/runtime/issues/70091", TestRuntimes.Mono)]
//public static unsafe void MakeTypedReference_ToObjectTests_WithPointer()
//{
// float* pointer = (float*)(nuint)0x12345678;
// TypedReference reference = __makeref(pointer);
// object obj = TypedReference.ToObject(reference);
//
// // TypedReference-s over pointers use the UIntPtr type when boxing
// Assert.NotNull(obj);
// Assert.IsType<UIntPtr>(obj);
// Assert.Equal((nuint)0x12345678, (nuint)obj);
//}
//
//[Fact]
//[ActiveIssue("https://github.com/dotnet/runtime/issues/70091", TestRuntimes.Mono)]
//public static unsafe void MakeTypedReference_ToObjectTests_WithFunctionPointer()
//{
// delegate*<int, float, string> pointer = (delegate*<int, float, string>)(void*)(nuint)0x12345678;
// TypedReference reference = __makeref(pointer);
// object obj = TypedReference.ToObject(reference);
//
// // TypedReference-s over function pointers use the UIntPtr type when boxing
// Assert.NotNull(obj);
// Assert.IsType<UIntPtr>(obj);
// Assert.Equal((nuint)0x12345678, (nuint)obj);
//}
[Fact]
public static unsafe void MakeTypedReference_ToObjectTests_WithPointer()
{
float* pointer = (float*)(nuint)0x12345678;
TypedReference reference = __makeref(pointer);
object obj = TypedReference.ToObject(reference);

// TypedReference-s over pointers use the UIntPtr type when boxing
Assert.NotNull(obj);
Assert.IsType<UIntPtr>(obj);
Assert.Equal((nuint)0x12345678, (nuint)obj);
}

[Fact]
public static unsafe void MakeTypedReference_ToObjectTests_WithFunctionPointer()
{
delegate*<int, float, string> pointer = (delegate*<int, float, string>)(void*)(nuint)0x12345678;
TypedReference reference = __makeref(pointer);
object obj = TypedReference.ToObject(reference);

// TypedReference-s over function pointers use the UIntPtr type when boxing
Assert.NotNull(obj);
Assert.IsType<UIntPtr>(obj);
Assert.Equal((nuint)0x12345678, (nuint)obj);
}

[Fact]
public static void MakeTypedReference_ReadOnlyField_Succeeds()
Expand Down