Skip to content

net8 JIT locks up in unit tests when calling into WPF #108506

Open
@FlsZen

Description

Description

While updating from net7 to net8, a couple of my unit tests started deadlocking. It looks like they deadlock in JIT while accessing System.Windows types.

image

Reproduction Steps

  1. Open attached Deadlock.sln
  2. Run the tests in Deadlock-net8 until failure

Deadlock.zip

Expected behavior

Running Deadlock-net8 tests should be successful each time.

Actual behavior

I observe it deadlocking at least every few runs.

Regression?

This works on net7. Run the tests in Deadlock-net7 until failure to observe.

Known Workarounds

Using xUnit Collection attributes to disable parallelization gets the test to run.

Impact

I'm concerned that this JIT / assembly loading issue could cause deadlocks at runtime.

While my test cases are narrowed to calling a WPF assembly, I'm not yet convinced that it isn't a runtime issue. I did try calling into a custom stub assembly instead of WPF and the tests ran fine. I'm not sure if the issue could be related to something like how long it takes the assembly to load or some other non-WPF criteria.

Configuration

.NET 8.0.0
Windows 11 x64
Unsure if specific to this configuration, but net7 runs the tests fine on the OS.

Other information

No response

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions