How to check if application is in debug mode

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Is there any way to check if the application is in debug mode or running
from the exe.


Thanks in advance,
Debi
 
If you really want to test for DEBUG mode , you could use conditional
compilation (#If directive) to create a function that returns true /false
depending on the DEBUG symbol...
If you meant rather that you want to know if a debugger is attached, you
could use System.Diagnostics.Debugger.IsAttached...
 
Debi,

It depends what your understanding of debug mode is.
If you want to discover if the code is compiled with debug information I
think using conditional compilation and checiking for the DEBUG symbol is
the way to find out whether the exectuable is started from VS you can't do
that in all the cases, you can find out wehether the program was started
with debigger attached though. Check System.Diagnostics.Debugger.IsAttached
and if it returns true this means someone is debugging the application. It
could be VS or any other debbuger.
 
Thanks for all the replies. System.Diagnostics.Debugger.IsAttached should
suit my purpose. I want to check if someone is debugging the application.
 
Back
Top