Description
Whenever I try to run assembly.GetTypes() on an assembly with a class similar to the one below I get an ExecutionEngineException. A minimal reproduction can be found here: https://github.com/roy-t/ExecutionEngineExceptionReproduction.
public abstract class ABase
{
public abstract object this[int index] { get; }
}
public sealed class Concrete<T> : ABase
where T : class
{
public override T this[int index] // <- covariant indexer
{
get
{
throw null;
}
}
}
I think the problem is the covariant indexer. Whenever I replace the covariant indexer with a regular one that just returns object the problem goes away. I've also tried to reproduce the problem with methods and properties with covariant return types, but that did not trigger the bug.
Update: after more experimentation I did find it possible to trigger this bug with covariant return types for methods and properties. See my comment down below.
Configuration
I'm running .NET 5.0 (v5.0.100) on Window 10 x64. I have not tried it on another machine yet.
Regression?
Not really, since .NET 5.0 is the first version that supports covariant return types. However in previous .net versions you were able to call GetTypes() on an assembly without a crash :).
Other information
Unfortunately there's no stack trace. The only information I get from Visual Studio is:
An unhandled exception of type 'System.ExecutionEngineException' occurred in System.Private.CoreLib.dll
The program '[17496] FooCrash.exe' has exited with code -1 (0xffffffff).
By the way, I hope this is the right GitHub project for these types of exceptions. I saw that System.Private.Corelib lives in this repository so it was my best guess :)
Description
Whenever I try to run
assembly.GetTypes()on an assembly with a class similar to the one below I get an ExecutionEngineException. A minimal reproduction can be found here: https://github.com/roy-t/ExecutionEngineExceptionReproduction.I think the problem is the covariant indexer. Whenever I replace the covariant indexer with a regular one that just returns
objectthe problem goes away. I've also tried to reproduce the problem with methods and properties with covariant return types, but that did not trigger the bug.Update: after more experimentation I did find it possible to trigger this bug with covariant return types for methods and properties. See my comment down below.
Configuration
I'm running .NET 5.0 (v5.0.100) on Window 10 x64. I have not tried it on another machine yet.
Regression?
Not really, since .NET 5.0 is the first version that supports covariant return types. However in previous .net versions you were able to call
GetTypes()on an assembly without a crash :).Other information
Unfortunately there's no stack trace. The only information I get from Visual Studio is:
By the way, I hope this is the right GitHub project for these types of exceptions. I saw that System.Private.Corelib lives in this repository so it was my best guess :)