1

This seems to be a similar problem like Visual Studio "Debug Unit Test" fails to hit breakpoints But his fixes didn't work for me.

  • VS2019 Professional, XUnit: I'm programming a server backend with controllers, I setup a new project for the test file and used one of the xunit templates, i got some intergration tests with a fake client for my server tests.

All worked fine at the beginning and at the point i set up a client, my debugger started to refuse to hit my breakpoints.

So, you press debug tests, it seems to debug, and after it ran through your tests(successful), it quits debugging. But my breakpoints in every testfile, in every constructor and mehod, were not hit.

  • they aren't white with red outline, they're normal full red circles
  • repairing vs didn't change anything
  • cleaning and rebuilding didn't change anything
  • my normal project is working and is able to be debugged correctly
  • I deleted my whole code in the project and had an empty constructor, which breakpoint wasn't hit (no connection to the main file)
  • Its Debug Version, not release version
  • updating all nuget packages isn't helping
  • restarting vs and the pc is not helping
  • no warnings or anything
  • setting the testproject to be the startproject didn't change anything
  • same problem on other devices

If you add more tests, you debug without hitting any breakpoints longer, because yor tests take longer & your tests give the correct result. Therefore I'm quite sure, it's really going past your breakpoints, because I mean, you got the results of the methods you trying to debug.

Crait
  • 11
  • 2

1 Answers1

0

Add a reference to the nuget package xunit.runner.visualstudio to your test project and try again. enter image description here

roney
  • 964
  • 3
  • 15
  • 37