-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[mono] Incorrect cast_class for IntPtr[] #97145
Comments
Looks like a bug in .NET 8 Mono. Given this program: internal class Program
{
static void Main(string[] args)
{
Console.WriteLine($"Running on {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}");
Console.WriteLine($"IntPtr.Size = {IntPtr.Size}");
object x0 = new long[1];
object x1 = new ulong[1];
Console.WriteLine($" x0 is IntPtr[] ? {x0 is IntPtr[]}");
Console.WriteLine($" x1 is IntPtr[] ? {x1 is IntPtr[]}");
}
} Here's output on various runtimes:
So modern Mono in .NET 8.0.1 is giving an incorrect answer. It should match CoreCLR 8.0.1 (Note: the tests in dotnet/runtime/src/mono/mono/mini/ don't run in CI, as far as I know). |
I think it's a problem in runtime/src/mono/mono/metadata/class-init.c Lines 1021 to 1053 in 24f9706
the code was introduced in mono/mono@2864540 and hasn't been updated for .NET 5+ it should probably set |
This change fixes the behavior to be like modern .NET instead of .NET Framework. Fixes dotnet#97145
Description
mono repo has a intptr array Unit Test code:
runtime/src/mono/mono/mini/arrays.cs
Line 693 in 13ab6eb
This test case argues that an integer type array should be able to convert the pointer type array
It's produce difference value
.Net Framwork = 0
.Net Core = 5
It like there's something wrong with the .Net Framework
The text was updated successfully, but these errors were encountered: