Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning given when debugging source code in visual studio 2010

I had set breakpoint in source code but it will give me warning that source code is different from original one. It will not hit breakpoint.Hit location to allow change in source code. can anybody explain me waht is problem?

like image 869
Abhijit Shelar Avatar asked Jan 19 '12 13:01

Abhijit Shelar


People also ask

How do I get rid of warning treatment as error in Visual Studio?

Turn off the warning for a project in Visual StudioSelect the Configuration Properties > C/C++ > Advanced property page. Edit the Disable Specific Warnings property to add 4996 . Choose OK to apply your changes.

How do I see warnings in Visual Studio?

To display the Error List, choose View > Error List, or press Ctrl+\+E.

What is just my code warning?

Just My Code is a Visual Studio debugging feature that automatically steps over calls to system, framework, and other non-user code. In the Call Stack window, Just My Code collapses these calls into [External Code] frames. Just My Code works differently in . NET, C++, and JavaScript projects.

What is a breakpoint in debugging?

Breakpoints are one of the most important debugging techniques in your developer's toolbox. You set breakpoints wherever you want to pause debugger execution. For example, you may want to see the state of code variables or look at the call stack at a certain breakpoint.

How do I debug a specific line in Visual Studio Code?

From the Debug Menu, there are various commands to start a debugging session, such as Start Debugging (F5), Step into (F11), and Step over (F10). You can start a debugging sessions with the Run to Cursor command. In the source editor, right click the target line of the source code and select the Run to Cursor (Ctrl+F10) command.

How do I start a debugging session in Visual Studio Code?

From the Debug Menu there are various commands to start a debugging sessions such as Start Debugging (F5), Step into (F11), and Step over (F10). You can start a debugging sessions with the "Run To Cursor" command. In the source editor, right-click the target line of the source code and select "Run To Cursor" (Ctrl+F10).

What are the errors and warning boxes in Visual Studio Code?

Applies to: Visual Studio Visual Studio for Mac Visual Studio Code Below are the errors and warning dialog boxes you may encounter while debugging your application. Microsoft Visual Studio Debugger (Exception Thrown) Dialog Box No Source Code Available for the Current Location Dialog Box

Why is it not possible to debug this error?

Error: Debugging Isn't Possible Because a Kernel Debugger is Enabled on the System Learn about breakpoints, one of the most important debugging techniques.


2 Answers

Checksum of source code file doesn't match checksum into the PDB file.

To solve that rebuild the solution.

Workaround: In Location property of a breakpoint check Allow source code to be different

like image 103
abatishchev Avatar answered Nov 14 '22 22:11

abatishchev


This can happen when you compile & run a release build. In Release builds the compiler makes optimizations that may change or delete portions of code, take this example:

static void Main()
{
    int x = 10 + 5;   // <---- BREAKPOINT HERE

    Console.WriteLine("Foo");
}

If you compile & run that code in a debug build, the breakpoint will be hit as usual. In a release build, the compiler will see that 'x' is never used, and will "optimize away" the entire line, which means the breakpoint will never be hit!

like image 38
MattDavey Avatar answered Nov 14 '22 23:11

MattDavey