Visual Studio testing interface crashing

Viewed 47

When I try to run some unit tests in Visual Studio, the Test Explorer starts the test then I get the following error indicator in Test Explorer:

enter image description here

The test keeps in blue, it doesn't pass and neither fails, as if it was not run.

And in my Output window I get the following error:

Building Test Projects
========== Starting test run ==========
The active test run was aborted. Reason: Test host process crashed : Process is terminated due 
to StackOverflowException.
Process is terminated due to StackOverflowException.
Process is terminated due to StackOverflowException.

========== Test run aborted: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========

But I cannot see any indication of stack overflow in the test. No huge call stacks or memory spikes, which is usually an indicator of that.

I get to this piece of code, by debugging line by line:

public async Task StopAsync(CancellationToken ct)
{
   Logger.Information("Stopping consumers and workers...");

   try
   {
       try
       {
          _cancellationTokenSource.Cancel();
       }
       catch (Exception ex)
       {
           Logger.Error(ex, "Exception during cancellation of the AJQ consumers / workers");
       }

      var timeout = _config.Bootstrapper.StopServiceTimeout;
      Logger.Information($"Stop of worker/consumer tasks requested (waiting for: {timeout.TotalSeconds} sec for tasks to complete)");
      var delayTask = Task.Delay(timeout, ct);
      var waitAllTask = Task.WhenAll(AllTasks);
      var tasks = new[] { delayTask, waitAllTask };
      await Task.WhenAny(tasks).ConfigureAwait(false);
    }
    catch (Exception ex)
    {
      Logger.Error(ex, "Exception ... ");
    }
}

In the last line when I press F10, the test simply stops, no error, no exception, nothing, it just stops running.

Any insight on how I could get more information about why this is happening?

0 Answers
Related