Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set a breakpoint in referenced code in Visual Studio?

My main solution is using code from a utility class library, that I wrote myself, but is a part from another solution. How can I set a breakpoint in the referenced DLL file?

like image 990
Dabblernl Avatar asked Apr 11 '10 16:04

Dabblernl


People also ask

How do you put a breakpoint in VS code?

To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.

Why is my breakpoint not working in Visual Studio code?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

How do I add a breakpoint to all methods in Visual Studio?

Press F3 and then press F9 to add a breakpoint.


2 Answers

Click Debug, New Breakpoint, Break at Function, then enter the full name of the function.

like image 173
SLaks Avatar answered Oct 29 '22 15:10

SLaks


In Visual Studio open the source file of your referenced DLL that contains the desired method manually using menu

File > Open > File...

Then set the breakpoint by clicking on the left border in the code editor. This enables you to break at any code line and not just at function calls. Visual Studio shows the breakpoint in a kind of disabled state, because it thinks that the code is unreachable. Just ignore it; the breakpoint will become active once the code runs and the DLL has been loaded.

Note: you must reference a Debug version of your assembly for this to work.

like image 39
Olivier Jacot-Descombes Avatar answered Oct 29 '22 16:10

Olivier Jacot-Descombes