What is the syntax and which namespace/class needs to be imported? Give me sample code if possible. It would be of great help.
+6
A:
Put the following where you need it:
System.Diagnostics.Debugger.Break();
MagicKat
2008-09-19 18:20:22
A:
you can use System.Diagnostics.Debugger.Break()
to break in a specific place.. this can help in situations like debugging a service.
Quintin Robinson
2008-09-19 18:20:23
+2
A:
http://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.break.aspx
#if DEBUG
System.Diagnostics.Debugger.Break();
#endif
benjynito
2008-09-19 18:20:58
+5
A:
I also like to check to see if the debugger is attached - if you call Debugger.Break when there is no debugger, it will prompt the user if they want to attach one. Depending on the behavior you want, you may want to call Debugger.Break() only if (or if not) one is already attached
using System.Diagnostics;
//.... in the method:
if( Debugger.IsAttached) //or if(!Debugger.IsAttached)
{
Debugger.Break();
}
Philip Rieck
2008-09-19 21:01:38