Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code Breakpoint warning: The source code is different from the original version

I'm very new to Visual Studio Code. I'm trying to debug an application that exists already that I've cloned via Git. None of my files are modified yet. I've downloaded the microsoft extension "C# for Visual Studio Code (powered by OmniSharp)". The application starts and it brings me to the home page (http://localhost:5000/). However it didn't stop at my breakpoints within startup.cs

When I look at the application while its running instead of being a red bullet point its a hollow gray breakpoint. Hovering over it tells me "The source code is different from the original version. To allow this breakpoint to be hit: Add "requireExactSource":false to launch.json and restart debugging.". I can't understand this.

I'm using:

  • Visual Code 1.17.1
  • Shell 1.7.7
  • renderer 58.0.3029.110
  • node 7.9.0
  • architecture x64

I'm also using dotnet version 1.0.3

like image 734
Sniipe Avatar asked Oct 11 '17 16:10

Sniipe


People also ask

How do I fix breakpoint in Visual Studio?

To disable a breakpoint without deleting it, hover over or right-click it, and select Disable breakpoint. Disabled breakpoints appear as empty dots in the left margin or the Breakpoints window. To re-enable a breakpoint, hover over or right-click it, and select Enable breakpoint.

How do you remove a breakpoint in VS Code?

You can delete all breakpoints in one of the following ways: On the Debug menu, click Delete All Breakpoints. On the toolbar of the Breakpoints window, click the Delete All Breakpoints button.


1 Answers

This happened to me when I upgraded my project from .NET Core 2.0 to 2.1. The problem was that I forgot to edit launch.json to change the binary path from netcoreapp2.0 to netcoreapp2.1 so VS Code was looking for binaries in the wrong place. Editing the path fixed the problem.

EDIT: I suggest VS Code team to adopt a variable-based approach to fix this issue completely, like having something like $TargetRuntime in the path instead of something hardcoded like netcoreapp2.1 etc.

like image 103
Sedat Kapanoglu Avatar answered Nov 14 '22 03:11

Sedat Kapanoglu