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.
- .NET Core 2.0 crashes fatally when a
Debug.Assert
fails - 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.
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 current open one has been marked as blocked:
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
And
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
Closed as no repro
No explanation of aborting test when a static constructor throws exception. #334 reported the same issues:
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.