-
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] Crash when calling an interface method on a struct through a generic default interface method #58394
[mono] Crash when calling an interface method on a struct through a generic default interface method #58394
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: Issue DetailsReported by @Jorenkv at mono/mono#21206 but also happens in .NET 6 using System;
class Program {
static void Main() {
(new Foo() as IFoo).NoCrash(); // Prints "Hello!" as expected
(new Foo() as IFoo).Crash<int>(); // Crashes
}
}
interface IFoo {
void Crash<T>() {
Bla();
}
void NoCrash() {
Bla();
}
void Bla();
}
struct Foo: IFoo {
public void Bla() {
Console.WriteLine("Hello!");
}
} Expected result: prints Hello! twice Actual result:
|
It's not a vtable layout issue probably . Both
It's a JIT issue: |
Don't unbox a valuetype `this` if the generic method is a DIM Fixes dotnet#58394
Don't unbox a valuetype `this` if the generic method is a DIM Fixes #58394
Don't unbox a valuetype `this` if the generic method is a DIM Fixes dotnet/runtime#58394
Don't unbox a valuetype `this` if the generic method is a DIM Fixes dotnet/runtime#58394
* [mini] Don't add unbox tramopline on generic DIM calls Don't unbox a valuetype `this` if the generic method is a DIM Fixes #58394 * Add regression test
Don't unbox a valuetype `this` if the generic method is a DIM Fixes dotnet/runtime#58394 Co-authored-by: lambdageek <[email protected]>
Don't unbox a valuetype `this` if the generic method is a DIM Fixes dotnet/runtime#58394 Fixes #21206 Co-authored-by: lambdageek <[email protected]>
…58585) * [mini] Don't add unbox tramopline on generic DIM calls Don't unbox a valuetype `this` if the generic method is a DIM Fixes #58394 * Add regression test Co-authored-by: Aleksey Kliger <[email protected]>
Don't unbox a valuetype `this` if the generic method is a DIM Fixes dotnet/runtime#58394 Co-authored-by: lambdageek <[email protected]>
Don't unbox a valuetype `this` if the generic method is a DIM Fixes dotnet/runtime#58394 Co-authored-by: lambdageek <[email protected]>
Don't unbox a valuetype `this` if the generic method is a DIM Fixes dotnet/runtime#58394 Co-authored-by: lambdageek <[email protected]>
Reported by @Jorenkv at mono/mono#21206 but also happens in .NET 6
Expected result: prints Hello! twice
Actual result:
Does not happen if
Foo
is aclass
not astruct
The text was updated successfully, but these errors were encountered: