Skip to content

NullReferenceException after parallel tests have finished executing #2662

@sanoursa

Description

@sanoursa

Using NUnit 3.9.0, we have enabled Parallelizable(ParallelScope.Fixtures), and while the tests all run correctly, about 30% of the time the test suite fails because NUnit's background thread throws a NullReferenceException with the following stack:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at 
NUnit.Framework.Internal.Execution.WorkItemQueue.get_IsEmpty() at 
NUnit.Framework.Internal.Execution.WorkShift.get_HasWork() at 
NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.SelectNextShift() at 
NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.OnEndOfShift(WorkShift endingShift) at 
NUnit.Framework.Internal.Execution.WorkShift.<StartWorkers>b__26_1(TestWorker s, WorkItem ea) at 
NUnit.Framework.Internal.Execution.TestWorker.TestWorkerThreadProc() at 
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at 
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at 
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at 
System.Threading.ThreadHelper.ThreadStart() 

Is this a known issue? Is there anything I can do to gather more information to help diagnose the problem?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions