Repository navigation
Closed
Description
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
Type
Projects
- StatusShow more project fieldsNo status
Activity
jkotas commentedon Nov 19, 2025
If you are not able to create a standalone repro and you are comfortable with sharing crash dumps with us, you can enable crash dumps by following https://learn.microsoft.com/en-us/dotnet/core/diagnostics/collect-dumps-crash, and then share the crash dump with us by opening issue at https://developercommunity.visualstudio.com/ and attaching the crashdump as a private attachment. (The crash dump contains like your local user name and environment.)
joergpichler commentedon Nov 20, 2025
I have attached a dump file here https://developercommunity.visualstudio.com/t/NET10:-ExecutionEngineException-when-cal/11003734. I am kind of able to track it down to it having something to do with WPF related classes being referenced by the test assembly, still not able to do a minimal repro though unfortunately.
Do not ignore ClassLoader::ResolveTokenToTypeDefThrowing return values
jkotas commentedon Nov 21, 2025
This is .NET 9 -> .NET 10 regression.
The crash is triggered by a static field that:
The field in triggering the crash in your tests is
draggableVectorthat has typeSystem.Windows.Vector. This type lives in WindowsBase.dll. There are two version of WindowsBase.dll: The full version that you get when your TargetFramework is set to net10.0-windows, and minimal version that you get when your TargetFramework is set to net10.0. Your test assembly was built against TargetFramework net10.0-windows, but it is running against net10.0 that does not have theSystem.Windows.Vectortype. You should be able to workaround the crash by making sure that you run the tests against TargetFramework net10.0-windows.Do not ignore ClassLoader::ResolveTokenToTypeDefThrowing return values
Do not ignore ClassLoader::ResolveTokenToTypeDefThrowing return values
joergpichler commentedon Nov 22, 2025
appreciate you digging into this and preparing a fix. I found the workaround as well digging through nunit console issues nunit/nunit-console#1328 still i was wondering why suddenly the runtime crashed when using net10. thanks again!
Do not ignore ClassLoader::ResolveTokenToTypeDefThrowing return values
Do not ignore ClassLoader::ResolveTokenToTypeDefThrowing return values
Do not ignore ClassLoader::ResolveTokenToTypeDefThrowing return values
Do not ignore ClassLoader::ResolveTokenToTypeDefThrowing return values
Do not ignore ClassLoader::ResolveTokenToTypeDefThrowing return values (