ethan
ethan

Reputation: 25

Breakpoint does not hit in Nunit Unit Tests

I am facing some kind of weird visual studio behavior I guess...

I have done Unit Testing in my application using NUnit, in some Unit Tests I have used NFluent and NSubstitute (to make my UT more readable and closer to human language)

Everything worked fine until suddenly I became unable to debug my unit tests.

When I run any test it passes and get green colored.

I figured out that there was a problem when I got an error in my build on VSTS and my test doesn't pass unlike in my dev env where every test is ok.

I tried to analyse test by test so I found that I am able to debug Tests made with NSubstitute and NFluent but tests which are written only using standard NUnit are undebugable ...

Here are the actions I made:

  • went to tools-options-test-logging and changed it to "Diagnostics" the way i can understand what is happening ==> found that many .dll are flagged as "unloaded"

  • I double checked that i am on debug environment

  • I clean rebuild / open/ close solution and visual studio

Nothing changed and I am still getting error on VSTS build and no errorson dev env neither I can debug on my local environment...

Any suggestion or solution will be welcome .

Upvotes: 2

Views: 1863

Answers (1)

Etem Quara
Etem Quara

Reputation: 48

I have run into something like that but not exactly (I did not use NSubstitute).

double check your project configuration, in my case the problem was about a difference between project configuration file and the processor type of visual studio which was overridden somehow.

I fixed it by modifying the processor architecture type to X64 instead of Any CPU.

hope that helps

Upvotes: 3

Related Questions