Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Debugger.Launch and Debugger.Break

What's the difference between

Debugger.Launch(); Debugger.Break(); 

?

like image 550
Nissim Avatar asked Sep 21 '10 10:09

Nissim


People also ask

What is break in debugger?

If a user-mode debugger is attached, the program will break into the debugger. This means that the program will pause and the debugger will become active.

How do I start debugging?

To debug, you need to start your app with the debugger attached to the app process. F5 (Debug > Start Debugging) is the most common way to do that. However, right now you may not have set any breakpoints to examine your app code, so we will do that first and then start debugging.

What is the difference between Debug write and trace write when should each be used?

Debug. Write is only effective on builds where the DEBUG flag is defined, while Trace. Write is only effective when the TRACE flag is defined.

How do breakpoints work in Visual Studio?

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. If you are trying to resolve a warning or issue while using breakpoints, see Troubleshoot breakpoints in the Visual Studio debugger.


2 Answers

Reading the documentation, it sounds like Launch does nothing if the debugger is attached - it doesn't actually break (although I haven't verified this).

Break asks to launch the debugger (if not attached), and does do the break.

In reality, it is unlikely you'd have more than one Launch point... if that.

like image 96
Marc Gravell Avatar answered Sep 29 '22 18:09

Marc Gravell


Launch will start a debugger when one is available. But is just ignored if there is none available. Break will crash the program if no debugger is available.

like image 38
Hans Passant Avatar answered Sep 29 '22 18:09

Hans Passant