Breakpoint does not work during the test either with NUnit and MSTest. Visual Studio 2022, Net 6

Andrzej 26 Reputation points
2022-10-10T20:14:38.603+00:00

Hi, I've created test project in my solution and when I want to debug my code set breakpoint it doesn't work when I click debug and it whole flow looks the same when I click run.

I don't have idea what should I do. I tried everything what I found in google but nothing help.
I made restart general settings in visual, I was looking any setting in tools, test, debug, build tab.

Maybe it is any magic way to correct this because it hard to write tests.
I can add that when I create new project new solution I've installed xUnit and it works so I guess it exist some problem in visual. Even reinstall visual studio didn't help.

If you need more information about my configuration VS 2022 please let me know.

Thanks for any help

Developer technologies | Visual Studio | Testing
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2022-10-11T04:22:49.39+00:00

    Hi @Andrzej ,

    Welcome to Microsoft Q&A!

    Do you have any error message or warning when the breakpoint doesn’t work? Are you debugging your test project in Debug or Release mode?

    If it is in Release mode, the breakpoints will not be hit. Please disable Just My Code and try again.

    Besides, you can try to delete the .vs folder in your project folder and try again.

    Sincerely,
    Anna
    *
    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.