Skip to content

[Bug]: Rider & VScode console breaks in tunit 1.13.x #4749

@faustin0

Description

@faustin0

Description

Running a test that contains Console.WriteLine followed by Task.Delay causes the Rider test runner to crash with a JsonRpcInternalErrorException.

Expected Behavior

The test should execute successfully, log output to the console, wait for the delay, and complete with the assertion passing.

Actual Behavior

  • The test process starts and outputs "Logging something"
  • The process is immediately aborted (exit code -1)
  • Rider logs a JsonRpcInternalErrorException
  • Error message: Process C:\Program Files\dotnet\dotnet.exe:15024 is being aborted

|I| Run: 6fd3c92f-c97b-432c-964b-313a37329fa4 - Faulted
|W| Element <RiderConcoleTest.1.1.Foo.1.1.0> was left Running after its run completion.
|I| RunTestsStage completed
|I| FinishLaunchStage started
|I| FinishLaunchStage completed

Steps to Reproduce

public class RiderConsoleTest( )
{
    [Test]
    public async Task Foo()
    {
        //this WriteLine + delay breaks the rider console
        Console.WriteLine("Logging something"); 
        await Task.Delay(1000); 
       
        await Assert.That(true).IsTrue();
    }
    
}

TUnit Version

1.13.x

.NET Version

.NET8

Operating System

Windows

IDE / Test Runner

JetBrains Rider

Error Output / Stack Trace

--- EXCEPTION #1/2 [JsonRpcInternalErrorException]
StackTraceString = “
  at JetBrains.JsonRpc.JsonRpc.InvokeAsync[TResult](String method, IReadOnlyList`1 args, CancellationToken ct) in InvokeAsync.il:line IL_0268 mvid 4CB9
     at JetBrains.ReSharper.UnitTestFramework.Common.Extensions.TaskExtensions.ThrowIf[TResult,TException](Task`1 task, Task signallingTask, Func`1 exceptionFactory) in ThrowIf.il:line IL_0000 mvid 0BCB
     at JetBrains.ReSharper.UnitTestFramework.Common.Extensions.TaskExtensions.CancelIf[TResult](Task`1 task, CancellationToken ct) in CancelIf.il:line IL_0000 mvid 0BCB
     at JetBrains.ReSharper.UnitTesting.VsTest.Provider.TestingPlatform.TestingPlatformRunStrategy.Run(IUnitTestRun run) in Run.il:line IL_01A6 mvid D9F7
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.StartCore(CancellationToken onCancel, CancellationToken onAbort) in StartCore.il:line IL_0000 mvid 0BCB or StartCore.il:line IL_01E7 mvid 0BCB
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.<>c.<StartCore>b__37_0(ExceptionDispatchInfo e) in UnitTestRun.il:line IL_0000 mvid 0BCB
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.StartCore(CancellationToken onCancel, CancellationToken onAbort) in StartCore.il:line IL_0000 mvid 0BCB or StartCore.il:line IL_01E7 mvid 0BCB
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.Start(CancellationToken onCancel, CancellationToken onAbort) in Start.il:line IL_0182 mvid 0BCB

ExceptionPath = Root.InnerException
ClassName = JetBrains.JsonRpc.JsonRpcInternalErrorException
HResult = COR_E_EXCEPTION=80131500
Source = System.Private.CoreLib

--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “Exception of type 'JetBrains.JsonRpc.JsonRpcInternalErrorException' was thrown.”
InnerException = “Exception #1 at Root.InnerException”
StackTraceString = “
  at JetBrains.Util.ILoggerEx.Error(ILogger logger, Exception exception, ExceptionOrigin origin, String comment) in Error.il:line IL_0000 mvid 4A80
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.Start(CancellationToken onCancel, CancellationToken onAbort) in Start.il:line IL_0182 mvid 0BCB
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) in ExecutionContextCallback.il:line IL_0000 mvid 5342
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute) in FinishSlow.il:line IL_0003 mvid 5342
     at System.Threading.Tasks.Task.TrySetException(Object exceptionObject) in TrySetException.il:line IL_0022 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField) in SetException.il:line IL_0025 mvid 5342
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.StartCore(CancellationToken onCancel, CancellationToken onAbort) in StartCore.il:line IL_0000 mvid 0BCB
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) in ExecutionContextCallback.il:line IL_0000 mvid 5342
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute) in FinishSlow.il:line IL_0003 mvid 5342
     at System.Threading.Tasks.Task.TrySetException(Object exceptionObject) in TrySetException.il:line IL_0022 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField) in SetException.il:line IL_0025 mvid 5342
     at JetBrains.ReSharper.UnitTesting.VsTest.Provider.TestingPlatform.TestingPlatformRunStrategy.Run(IUnitTestRun run) in Run.il:line IL_01A6 mvid D9F7
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute) in FinishSlow.il:line IL_0003 mvid 5342
     at System.Threading.Tasks.Task.TrySetException(Object exceptionObject) in TrySetException.il:line IL_0022 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField) in SetException.il:line IL_0025 mvid 5342
     at JetBrains.ReSharper.UnitTestFramework.Common.Extensions.TaskExtensions.CancelIf[TResult](Task`1 task, CancellationToken ct) in CancelIf.il:line IL_0000 mvid 0BCB
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task`1.TrySetResult(TResult result) in TrySetResult.il:line IL_004B mvid 5342
     at System.Threading.Tasks.Task.TwoTaskWhenAnyPromise`1.Invoke(Task completingTask) in Invoke.il:line IL_0088 mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute) in FinishSlow.il:line IL_0003 mvid 5342
     at System.Threading.Tasks.Task.TrySetException(Object exceptionObject) in TrySetException.il:line IL_0022 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField) in SetException.il:line IL_0025 mvid 5342
     at JetBrains.ReSharper.UnitTestFramework.Common.Extensions.TaskExtensions.ThrowIf[TResult,TException](Task`1 task, Task signallingTask, Func`1 exceptionFactory) in ThrowIf.il:line IL_0000 mvid 0BCB
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task`1.TrySetResult(TResult result) in TrySetResult.il:line IL_004B mvid 5342
     at System.Threading.Tasks.Task.TwoTaskWhenAnyPromise`1.Invoke(Task completingTask) in Invoke.il:line IL_0088 mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute) in FinishSlow.il:line IL_0003 mvid 5342
     at System.Threading.Tasks.Task.TrySetException(Object exceptionObject) in TrySetException.il:line IL_0022 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception, Task`1& taskField) in SetException.il:line IL_0025 mvid 5342
     at JetBrains.JsonRpc.JsonRpc.InvokeAsync[TResult](String method, IReadOnlyList`1 args, CancellationToken ct) in InvokeAsync.il:line IL_0268 mvid 4CB9
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute) in FinishSlow.il:line IL_0003 mvid 5342
     at System.Threading.Tasks.Task.TrySetException(Object exceptionObject) in TrySetException.il:line IL_0022 mvid 5342
     at JetBrains.JsonRpc.JsonRpc.HandleResponseAsync(JsonRpcResponse response) in HandleResponseAsync.il:line IL_0000 mvid 4CB9
     at JetBrains.JsonRpc.JsonRpc.HandleMessage(JsonRpcMessage message) in HandleMessage.il:line IL_003B mvid 4CB9
     at JetBrains.JsonRpc.JsonRpc.HandleMessagesAsync() in HandleMessagesAsync.il:line IL_00D1 mvid 4CB9
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at JetBrains.JsonRpc.HeaderDelimitedMessageTransport.ReadAsync(CancellationToken ct) in ReadAsync.il:line IL_0191 mvid 4CB9
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at JetBrains.JsonRpc.HeaderDelimitedMessageTransport.ReadContentSizeAsync(CancellationToken ct) in ReadContentSizeAsync.il:line IL_0100 mvid 4CB9
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.Threading.Tasks.Task`1.TrySetResult(TResult result) in TrySetResult.il:line IL_004B mvid 5342
     at System.IO.StreamReader.ReadLineAsyncInternal(CancellationToken cancellationToken) in ReadLineAsyncInternal.il:line IL_03E6 mvid 5342
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) in RunOrScheduleAction.il:line IL_003B mvid 5342
     at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) in RunContinuations.il:line IL_0065 mvid 5342 or RunContinuations.il:line IL_0090 mvid 5342
     at System.IO.StreamReader.ReadBufferAsync(CancellationToken cancellationToken) in ReadBufferAsync.il:line IL_0297 mvid 5342
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) in RunInternal.il:line IL_0040 mvid 5342
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) in MoveNext.il:line IL_0000 mvid 5342 or MoveNext.il:line IL_003A mvid 5342
     at System.Net.Sockets.SocketAsyncEventArgs.<>c.<.cctor>b__174_0(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) in SocketAsyncEventArgs.il:line IL_0046 mvid 9433
     at System.Threading.PortableThreadPool.IOCompletionPoller.Callback.Invoke(Event e) in Invoke.il:line IL_003A mvid 5342
     at System.Threading.ThreadPoolTypedWorkItemQueue`2.System.Threading.IThreadPoolWorkItem.Execute()
     at System.Threading.ThreadPoolWorkQueue.Dispatch() in Dispatch.il:line IL_019C mvid 5342
     at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() in WorkerThreadStart.il:line IL_00A0 mvid 5342

ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600

Additional Context

JetBrains Rider 2025.3.2
TUnit v1.13.0.0 | 64-bit | Microsoft Windows 10.0.22631 | win-x64 | .NET 8.0.23 | Microsoft Testing Platform v2.1.0
Engine Mode: SourceGenerated

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions