How do I determine what exception caused Test Explorer to crash?

2.6k views Asked by At

When I ran tests in prior versions of Visual Studio Test Explorer and there was a problem that caused the build runner to crash (such as AccessViolationException, StackOverflowException, OutOfMemoryException, etc), it would output a message displaying the exception type thrown and how to enable a log to get more details.

With Visual Studio 2017 Community Edition version 15.3.2 and .NET Core 1.0, when there is a crash all that is shown in the Test Output is:

[8/30/2017 3:03:42 AM Error] The active Tests Run was aborted.

[8/30/2017 3:03:42 AM Informational] ========== Run test finished: 1030 run (0:41:12.5762484) ==========

How can I determine what type of exception caused the build runner to crash (preferably with a stack trace)?

NOTE: I have opened an issue with NUnit during this investigation asking about how to determine which tests are causing the crash. I have already isolated (and worked around) 2 of the causes.

  1. .NET Core 2.0 crashes fatally when a Debug.Assert fails
  2. The test runner was running out of virtual memory due to running under 32 bit.

But there is still at least one more issue causing a crash. I am trying to work out why the test runner crashes in Visual Studio 2017 but does not crash on the command line.

Also note that this particular crash does not happen when running on .NET Framework, so suggestions to use command line tools that don't support .NET Core 1.0 or .NET Core 2.0 (such as vstest.console.exe) are not helpful.

1

There are 1 answers

1
AudioBubble On

This have been several reported issues similar to this. It appears to be a bug with the Entity Framework Core that hasn't been fixed yet. It was also a problem in the .NET Core command-line (CLI) that's been fixed.

Open issue

SqlLite.FunctionalTests sometimes fail on Ubuntu #8642 also has the same issue, different app type, but same issue. The OP is also having difficulty finding a trace of the error.

The active test run was aborted. Reason: 
null

The current open one has been marked as blocked:

Discussed again in triage and decided that we need to get more info from the test runner. Commented on Microsoft/vstest#527 asking for more info. Marking as blocked for now until we get some info from the vstest team.

Closed on 22 Jun

There is a The reason why the test run was aborted is not indicated. #527
which was marked as a duplicate of:
Show the test which crashed the test run (test explorer) #627

The solutions being

This is fixed in latest dev builds of dotnet-cli 2.0.0-preview1-005963. Download it from https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-dev-win-x64.latest.zip.

We have also fixed it for VS. Will update when a build with fix is available.

Note: issue will show for netcoreapp2.0 due to dotnet/cli#6535.

And

.../ fix is available in VS15.3.0 preview2.

How to get logs of the crash

Apart from ensuring you've enable diagnostics (which I'm sure you have), or running it on a console.

A comment from the github issue Show the test which crashed the test run (test explorer) #627

Can you enable --diag:log.txt switch to get more logs and analyze log.txt and log.*.host.txt for more details?

Closed as no repro

No explanation of aborting test when a static constructor throws exception. #334 reported the same issues:

The active test run was aborted. Reason:

No reason.

It was closed as no repro.


To address the need to run the nunit tests on the main thread Running unit tests with a main loop.