stack-overflowxunitasp.net-core-cli

Stackoverflowexception with xUnit and dotnet CLI - which test?


I'm using dotnet to run my unit tests in xUnit.

In one of my unit tests I get a Stackoverflow. How do I determine which unit test causes this?

Project.json (relevant parts):

 "dependencies": {
    "NLog": {
      "target": "project"
    },
    "xunit": "2.2.0-beta2-build3300",
    "dotnet-test-xunit": "2.2.0-preview2-build1029"
  },
 "testRunner": "xunit",
  "frameworks": {
        "net451": {
            "dependencies": {
                "Microsoft.NETCore.Platforms": "1.0.1"
            }
        }
  }

Running:

> dotnet test

Current result:

xUnit.net .NET CLI test runner (64-bit Desktop .NET win81-x64)
  Discovering: NLog.UnitTests
  Discovered:  NLog.UnitTests
  Starting:    NLog.UnitTests

Process is terminated due to StackOverflowException.
SUMMARY: Total: 1 targets, Passed: 0, Failed: 1.

I'm using xUnit to run unit tests under .NET Core and .NET 4.5.1 (currently only .NET 4.5.1 used in the example)

PS: dotnet test --verbose does not exists


Solution

  • Found it by running the test in Visual Studio. The GUI makes it clear which test was the issue.