Kackao
Kackao

Reputation: 1281

Visual Studio (2013) Unit Test fails with C0000005

I just set up a new (native) unit test in a new Solution. But even the example program does not work if I add an Assertion. It compiles without problems and the default generated (empty) test succeeds. But when I add a simple Assertion it fails with error code C0000005.

This is probably related to a similar issue, but I don't even have some library connected and therefore can't use the proposed solutions.

The test looks like this:

#include "stdafx.h"
#include "CppUnitTest.h"

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace Test_Native
{       
TEST_CLASS(UnitTest1)
{
public:

    TEST_METHOD(TestMethod1)
    {
        Assert::AreEqual(1, 1, L"message", LINE_INFO());  // Without this line everything is fine
        // TODO: Your test code here
    }

};
}

Upvotes: 0

Views: 746

Answers (1)

Ionut V.
Ionut V.

Reputation: 110

This is a known bug. Unfortunately, Microsoft considers this as "Won't Fix".

In short, there are two workarounds:

Compile the actual project in release mode and the test project in debug mode. Outsource all testable functions to a static library project.

Upvotes: 2

Related Questions