Search code examples
visual-studiounit-testingnunitresharpervs-unit-testing-framework

Unit-Test fails when run via VS Test Explorer but pass via Resharper


I have a unit test in NUnit that call a recursive C++ function from CLI code.

The unit

[Test]
public void MyTest()
{
    bool result = new MyClass().RecursiveFunction();
    Assert.True(result);
}

As mentioned, RecursiveFunction() is a CLI function, which just call a C++ recursive function.

The unit test pass when I run it from Resharper's test explorer, however, when I try to run it from Visual Studio Test Explorer it fails due to StackOverflowException. In both cases I use x64 build & run configuration, and in both cases I use no shadow copy.


Solution

  • We had the exact same issue,
    If you are using team city and your nunit version is 2.6.4 we upgraded out nunit version into 3.9,
    please note nunit changed the API and the upgrade might take a few hours,
    and also the structure of the libraries of the nunit-console and nunit framework was changed.
    Once we upgraded it to the new Nunit version it solved the issue.

    I found this issue solved in the team city forums and I did upgrade nunit and it worked.