Skip to content

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

Closed

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

Activity

  1. added
    untriaged
    on Nov 19, 2025
  2. added
    needs-area-label
    on Nov 19, 2025
  3. added and removed
    needs-area-label
    on Nov 19, 2025
  4. jkotas commented on Nov 19, 2025

    @jkotas
    Member

    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.)

  5. added
    needs-author-action
    on Nov 19, 2025
  6. joergpichler commented on Nov 20, 2025

    @joergpichler
    Author

    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.

  7. removed
    needs-author-action
    on Nov 20, 2025
  8. jkotas commented on Nov 21, 2025

    @jkotas
    Member

    This is .NET 9 -> .NET 10 regression.

    The crash is triggered by a static field that:

    • The type of the field must be a struct type
    • The struct type lives in external assembly.
    • The external assembly exists, but the struct type is missing in that assembly.

    The field in triggering the crash in your tests is draggableVector that has type System.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 the System.Windows.Vector type. You should be able to workaround the crash by making sure that you run the tests against TargetFramework net10.0-windows.

  9. added 2 commits that reference this issue on Nov 22, 2025
    c5bb40c
    e56b25d
  10. joergpichler commented on Nov 22, 2025

    @joergpichler
    Author

    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!

  11. added 3 commits that reference this issue on Nov 23, 2025
    3ed948f
    f5a5be7
    78ec161
  12. added a commit that references this issue on Nov 25, 2025
    254f82e
  13. removed
    untriaged
    on Nov 26, 2025
  14. added a commit that references this issue on Nov 26, 2025
    e207ac1
  15. locked and limited conversation to collaborators on Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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