Skip to content

NET10: ExecutionEngineException when calling Assembly.GetTypes() #121791

@joergpichler

Description

@joergpichler

Description

We are using NUnit-Console to fetch all tests from a test assembly. It works flawlessly under .NET Framework 4.8, .NET8 & .NET9 but after the switch to .NET10 NUnit-Console suddenly throws System.ExecutionEngineException. I debugged it a little bit and see it happening when it is calling Assembly.GetTypes(). Not sure how to provide more information on it currently.

Reproduction Steps

Using a simple test.dll it does not crash. Still trying to figure out how to create a minimal repro example.

Expected behavior

Does not crash

Actual behavior

Crashes

Call Stack:

 	[System.ExecutionEngineException unhandled]	
 	[Managed to Native Transition]	
>	System.Private.CoreLib.dll!System.Reflection.RuntimeModule.GetDefinedTypes() Line 408	C#
 	System.Private.CoreLib.dll!System.Reflection.RuntimeModule.GetTypes() Line 415	C#
 	nunit.framework.dll!NUnit.Framework.Api.DefaultTestAssemblyBuilder.GetCandidateFixtureTypes(System.Reflection.Assembly assembly, NUnit.Framework.Internal.PreFilter filter)	Unknown
 	nunit.framework.dll!NUnit.Framework.Api.DefaultTestAssemblyBuilder.GetFixtures(System.Reflection.Assembly assembly, NUnit.Framework.Internal.PreFilter filter)	Unknown
 	nunit.framework.dll!NUnit.Framework.Api.DefaultTestAssemblyBuilder.Build(System.Reflection.Assembly assembly, string assemblyNameOrPath, System.Collections.Generic.IDictionary<string, object> options)	Unknown
 	nunit.framework.dll!NUnit.Framework.Api.DefaultTestAssemblyBuilder.Build(System.Reflection.Assembly assembly, System.Collections.Generic.IDictionary<string, object> options)	Unknown
 	nunit.framework.dll!NUnit.Framework.Api.NUnitTestAssemblyRunner.Load.AnonymousMethod__0()	Unknown
 	nunit.framework.dll!NUnit.Framework.Api.NUnitTestAssemblyRunner.WrapInNUnitCallContext<System.__Canon>(System.Func<System.__Canon> function)	Unknown
 	nunit.framework.dll!NUnit.Framework.Api.NUnitTestAssemblyRunner.Load(System.Reflection.Assembly assembly, System.Collections.Generic.IDictionary<string, object> settings)	Unknown
 	nunit.framework.dll!NUnit.Framework.Api.FrameworkController.LoadTests()	Unknown
 	[Lightweight Function]	
 	System.Private.CoreLib.dll!System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(object obj, System.Reflection.BindingFlags invokeAttr) Line 87	C#
 	nunit.engine.core.dll!NUnit.Engine.Drivers.NUnitNetCore31Driver.ExecuteMethod(System.Reflection.MethodInfo method, object[] args) Line 207	C#
 	nunit.engine.core.dll!NUnit.Engine.Drivers.NUnitNetCore31Driver.ExecuteMethod(string methodName, object[] args) Line 189	C#
 	nunit.engine.core.dll!NUnit.Engine.Drivers.NUnitNetCore31Driver.Load(string assemblyPath, System.Collections.Generic.IDictionary<string, object> settings) Line 104	C#
 	nunit.engine.core.dll!NUnit.Engine.Runners.DirectTestRunner.LoadDriver(NUnit.Engine.Extensibility.IFrameworkDriver driver, string testFile, NUnit.Engine.TestPackage subPackage) Line 136	C#
 	nunit.engine.core.dll!NUnit.Engine.Runners.DirectTestRunner.LoadPackage() Line 126	C#
 	nunit.engine.core.dll!NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded() Line 243	C#
 	nunit.engine.core.dll!NUnit.Engine.Runners.DirectTestRunner.Explore(NUnit.Engine.TestFilter filter) Line 67	C#
 	nunit.engine.core.dll!NUnit.Engine.Communication.Transports.Tcp.TestAgentTcpTransport.CommandLoop() Line 101	C#
 	System.Private.CoreLib.dll!System.Threading.Thread.StartCallback() Line 736	C#

Regression?

Works in .NET 8 & .NET9

Known Workarounds

No response

Configuration

Win 11 .NET 10.0.0

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions