Debug Mode

M

Micah

I am looking for a way to tell if the program is compiled in debug
mode, I want the application I am writing to spit out a message to QA
if a error occured and if it is in debug mode, but if it is in release
mode, I want it to keep the error to itself. is there a way to do this
if so how ?

Micah
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Micah) scripsit:
I am looking for a way to tell if the program is compiled in debug
mode, I want the application I am writing to spit out a message to QA
if a error occured and if it is in debug mode, but if it is in release
mode, I want it to keep the error to itself. is there a way to do this
if so how ?

\\\
#If DEBUG Then
Console.WriteLine("Debug mode.")
#Else
Console.WriteLine("Release mode.")
#End If
///

- and/or -

'System.Diagnostics.Debugger.IsAttached'
 
B

Brian Henry

Isn't it correct thoug that if you use the compiler constants, it will only
compile the code into the app if it is set up with that constant? unlike
where if you asked if the debugger is attached which would be in every
compile... just wanted to point that out as a possible issue if they expect
the code to be compiled into the app if they use the compiler constants
version of it.
 
M

Micah Armantrout

Keyword - DEBUG in a if statement can not be used in a expression also,
'System.Diagnostics.Debugger.IsAttached'
states that a debugger like interdev is attached, QA does not have
Interdev on there machines for it to be attached with,I just want to
know if it was compliled in debug mode or not. Maybe
'System.Diagnostics.Debugger.IsAttached' is what I am looking for but I
thought that ment if Interdev was attached to the process ?

Micah
\\\
#If DEBUG Then
Console.WriteLine("Debug mode.")
#Else
Console.WriteLine("Release mode.")
#End If
///
 
H

Herfried K. Wagner [MVP]

Addendum:
\\\
#If DEBUG Then
Console.WriteLine("Debug mode.")
#Else
Console.WriteLine("Release mode.")
#End If
///

I forgot to mention that you will have to perform these steps in order
to make the code above work:

.... in the prioject properties, "Configuration settings" -> "Build" the
checkbox "Define DEBUG constant" must be checked.
 
M

Micah Armantrout

Debug is checked, but is still is not a key word ? What am I doing wrong
?

Micah
 
G

Guest

I have similar problem but the application is not VB.NET. It is VB 6.0. How
do I print the debug string to the console window?
 
H

Herfried K. Wagner [MVP]

* Micah Armantrout said:
Debug is checked, but is still is not a key word ? What am I doing wrong
?

If you are typing '#If ' into the code editor, does intellisense pop up
a listbox containing "DEBUG"?
 
G

Guest

Any debug string. I can't use msg box to show the string because it will
pause the process. Simply, I want to print to the string the console window
during the process excution like C run time library function: printf(...).

Thank you for the help.
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?eHBpbmc=?= said:
Any debug string. I can't use msg box to show the string because it will
pause the process. Simply, I want to print to the string the console window
during the process excution like C run time library function: printf(...).

VB6 doesn't support console applications.

<URL:http://mvps.org/vb/code/Console.zip>
 
H

Herfried K. Wagner [MVP]

* Micah Armantrout said:
I think your looking for
Debug.Print in VB6

For writing to the debug window when running the project inside the IDE
-- yes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top