Visual Studio 2022 - not fire unit tests in debug mode

Dani_S 4,836 Reputation points
2025-12-11T18:51:22.27+00:00

Hi,

Please see:

https://app.screencast.com/YwqnKkUGuwlR4

How is can be solved?

Thanks,

Developer technologies | Visual Studio | Debugging
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-11T18:51:40.65+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    If you are having trouble firing unit tests in debug mode in Visual Studio 2022, here are a few steps you can take to troubleshoot the issue:

    1. Set Breakpoints: Ensure that you have set breakpoints in your test methods. Since test methods can run in any order, it's important to set breakpoints in all the test methods you want to debug.
    2. Use Test Explorer: Open Test Explorer by navigating to Test > Windows > Test Explorer. From there, you can select the test methods you want to debug, right-click, and choose Debug.
    3. Check Configuration: Make sure that your project is configured correctly for debugging. Sometimes, issues can arise if the project settings are not set to debug mode.
    4. Rebuild the Project: If the tests are not showing up in Test Explorer, try rebuilding the project to refresh the test list.
    5. Check for Errors: Look for any errors in the Output window that may indicate issues with test discovery or execution. For instance, if you see a ReadOnlySpan error, it may be related to a known MSBuild issue that can be resolved by renaming certain files in the Visual Studio installation directory.
    6. Update Visual Studio: Ensure that you are using the latest version of Visual Studio 2022, as updates often include bug fixes and improvements that may resolve your issue.

    If these steps do not resolve the issue, consider consulting the Visual Studio documentation or community forums for additional support.


    References:

    0 comments No comments

  2. Susmitha T (INFOSYS LIMITED) 1,790 Reputation points Microsoft External Staff
    2025-12-12T07:55:06.4+00:00

    Thank you for reaching out!

     
    You can try to start debugging your tests:

    1. Set Breakpoints: First, set breakpoints in the test methods that you want to debug. Since test methods can run in any order, make sure to set breakpoints in all the relevant test methods.
    2. Use Test Explorer:
      • Open Test Explorer in Visual Studio (you can find it under the Test menu > Windows > Test Explorer).
        • Select the test methods you want to debug.
          • Right-click on the selected tests in the pane and select Debug.

    This should start a debugging session where you can step through your code and inspect the flow and values.

     
    I'm unable to view the screenshot you attached. Could you please share it again, It will be help us to resolve the issue.

     

     

    Let me know if you need any further help with this. I will be happy to assist. If you find this helpful, Kindly mark the provided solution as "Accept Answer", so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.


Your answer

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