Sanoop
Sanoop

Reputation: 81

All unit tests that are run are exiting with code 0 (0x0) without even hitting breakpoint

I'm running Visual Studio 2017 15.9.The program gets built successfully but every time I right click "debug test" the compiler exits with the message:

The program '[xxxxx] testhost.x86.exe' has exited with code 0 (0x0)

Both debug output screen and test output screen show the message

VirtualReadOnlyTestDataStore.OperationStateChanged State=TestExecutionFinished, operationInProgress=False TestDiscoveryStats.OperationStateChanged State=TestExecutionFinished, InProgress=False

This message appears even after putting in a function breakpoint. The breakpoint is not hit by the compiler and it exits with the same message. There seems to be nothing wrong with the code as it works fine on my colleague's laptop. Also, none of the tests in the test explorer show the green tick mark, they all have the blue exclamation mark

I tried changing the test setting>Default processor architecture to x64 (my computer is 64 bit). I had updated VS to latest version. Even tried reinstalling Visual Studio and again it shows the same error.

The thread 0x5aa8 has exited with code 0 (0x0). The thread 0x166c has exited with code 0 (0x0). The program '[13392] testhost.exe' has exited with code 0 (0x0).

Upvotes: 8

Views: 17657

Answers (6)

MyDaftQuestions
MyDaftQuestions

Reputation: 4691

Within a file with [SetUpFixture], I had a property that was not initialising correctly.

Since this piece of code worked before hand, I simply added break points on anything that could occur during initialisation or around that time. This means, didn't put break points within the tests, rather than within the SetUp or TearDown or any properties/constructures within files with SetUpFixture - one of those break points was hit and I could debug it

Upvotes: 0

Gabriel Anderson
Gabriel Anderson

Reputation: 1391

In my case, I have a decorator without (), so the solution was fix this and all works fine again:

before:

[TestCleanup]

after:

[TestCleanup()]

Upvotes: 0

martinp999
martinp999

Reputation: 449

I found that I needed to add a further Nuget package. I had already added -

  • xunit
  • xunit.abstractions

What I was missing was -

  • xunit.runner.visualstudio

Upvotes: 1

Tal L
Tal L

Reputation: 352

Had this same "The program '[10444] testhost.x86.exe' has exited with code 0 (0x0)." error. UT was testing async code and turned out I was missing 'Task' as return value of the test method.

Upvotes: 4

Lan Nguyen
Lan Nguyen

Reputation: 1

I have the same issue in VS2017, but not in VS2019. I tried to add UNITTESTEXPLORER_VSINSTALLPATH but not work. Then I found the solution which works fine in my case: Properties of the Solution --> Configurations Properties --> check BUILD column for the test project.

Upvotes: -1

Sanoop
Sanoop

Reputation: 81

Got the answer from :https://social.msdn.microsoft.com/Forums/vstudio/en-US/9764695d-e222-43dc-a993-209458bb2e83/not-able-to-debug-my-coded-ui-tests-after-updating-visual-studio-enterprise-2017-from-1532-to?forum=vsunittest

Had to set the system environment value:

Variable Name: UNITTESTEXPLORER_VSINSTALLPATH (two underscores) Variable Value: Visual Studio IDE location [like C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE]

Upvotes: 0

Related Questions