How Do I disable the source Server Code preview when debugging

gklein 20 Reputation points
2024-10-22T00:09:57.34+00:00

This has been a problem for me since I updated Visual studios.

For reference I am Currently on Visual Studios Professional 2022 17.11.5

With recent updates, it appears that Microsoft has introduced a new feature that opens a code editor with previously saved version of a .cs file while debugging. For context, this file is displayed as a "Preview" and the resides under AppData/Local/SourceServer. The problem is that this code editor is opened every time I try to set a break point while debugging a module that I have modified in the code editor. Originally, when the break was set in the target code editor it would display a warning along the lines of "The breakpoint will not currently be hit. The source code is different from the original version.". For me this is the preferred behavior, I use custom tools to load the each build into the app domain and need to able to set breakpoints in advance. How can I revert back to this behavior?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,231 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
1,006 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 29,936 Reputation points Microsoft Vendor
    2024-10-22T03:46:21.5266667+00:00

    Hi @gklein, 

    Welcome to Microsoft Q&A! 

    The issue has been fixed in Visual Studio 2022 version 17.10.6, you could see the similar issue:

    VisualStudio debugger using older version of source files - Developer Community 

    If it persists, you can try the following workarounds:

    1. Go to Tools > Options > Debugging > General > uncheck Enable Source Link support.
    2. Go to Tools > Options > Debugging > General > uncheck Enable source server support.
    3. Go to Tools > Options > Debugging > General > check Require source files to exactly match the original version.
    4. Go to Tools > Options > Debugging > General > check Enable Just My Code.
    5. Roll back VS to previous version by opening Visual Studio Installer > More > Rollback to previous version.
    6. Report it to product team by selecting “Help” menu > Send Feedback

    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.

     


3 additional answers

Sort by: Most helpful
  1. tobeyjennings-5150 0 Reputation points
    2024-10-22T05:55:10.6066667+00:00
    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. tobeyjennings-5150 0 Reputation points
    2024-10-22T05:57:27.0266667+00:00
    0 comments No comments

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.