-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
Description
Due to the changes made in #57086, initializing a type with variant interfaces can result in a TypeLoadException. The exception only occurs when using the Mono version of the Microsoft.NETCore.App runtime.
Reproduction Steps
public abstract class Foo : IComparable<Foo>, IComparable<Bar>
{
public abstract int CompareTo(Foo other);
public abstract int CompareTo(Bar other);
}
public sealed class Bar : Foo
{
public override int CompareTo(Foo other)
{
return 1;
}
public override int CompareTo(Bar other)
{
return 1;
}
}Test method:
new Bar();Expected behavior
Program runs without exception.
Actual behavior
The program throws an exception:
Unhandled Exception:
System.TypeLoadException: Recursive type definition detected TypeLoadExceptionBug.Bar
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Recursive type definition detected TypeLoadExceptionBug.Bar
Regression?
Yes. This works as expected when using Mono for net5.0 and net472.
Known Workarounds
No response
Configuration
No response
Other information
No response