Is Visual Studio's Breakpoint broken?

Cynolycus 255 Reputation points
2023-03-23T12:18:07.7066667+00:00

I am trying to create a windows forms app and have come across two problems with the breakpoint and would like to know if there is a way to fix it.

I get the message

"This source file has been changed. It no longer matches the version of the file used to build the application being debugged."

when I haven't changed any code.

If I start Visual Studio and run my application I have no problems but if I start Visual Studio then add a breakpoint before I run my application I will get the message.

The only thing different is the breakpoint, and it's added before I run the app, so how is that considered changing the code?

I have also noticed that adding a breakpoint can at times cause the application to behave differently to when there is no breakpoint. It seems that the breakpoint stops an event that would normaly happen if the break point wasn't there. Although I don't have any timers in the app it is kind of like an event was on a timer and the breakpoint pauses the app but not the timer, then the timer runs out and the event doesn't get triggered within the alloted time because the app is still paused.

Any ideas on how to solve these problems?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,033 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 30,336 Reputation points Microsoft Vendor
    2023-03-24T07:46:58.08+00:00

    Hi @Cynolycus ,

    Welcome to Microsoft Q&A forum.

    For the first problem, after rebuilding, the corresponding .pdb files will be regenerated and the error message should disappear. If the error still exists, I may consider that there’s still some debugging cache, please try to remove the hidden .vs folder in your solution folder and rebuild the project.

    For the detailed error message => "This source file has been changed…"

    1. Are you using any source control tools? If so, did any team members change the source file?
    2. Is there any copy of your project/solution?
    3. If you added some references to your project, can you confirm that there’s no similar dll file(maybe with the same name but not the same version) which may be used by VS by mistake when debugging?

    For the second problem, not very sure if it appears in a specific project or in every projects, if the issue is reproducible, please share us some detailed steps/a minimal sample to reproduce this issue and check further.

    Feel free to contact us.

    Sincerely,

    Tianyu


    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.

    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.