By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

Debug Mode

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
* ma*********@gmail.com (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'

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2

P: n/a
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.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2o************@uni-berlin.de...
* ma*********@gmail.com (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'

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

P: n/a
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
///
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #4

P: n/a
Addendum:
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
///


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 S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #5

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

Micah

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #6

P: n/a
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?
"Herfried K. Wagner [MVP]" wrote:
Addendum:
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
///


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 S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7

P: n/a
* Micah Armantrout <ma*********@gmail.com> scripsit:
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"?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #8

P: n/a
* "=?Utf-8?B?eHBpbmc=?=" <xp***@discussions.microsoft.com> scripsit:
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?


What debug string?

Take a look at the source code provided at
<URL:http://www.vb-hellfire.de/knowlib/isinide.php>.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #9

P: n/a
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.

"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?eHBpbmc=?=" <xp***@discussions.microsoft.com> scripsit:
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?


What debug string?

Take a look at the source code provided at
<URL:http://www.vb-hellfire.de/knowlib/isinide.php>.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #10

P: n/a
* "=?Utf-8?B?eHBpbmc=?=" <xp***@discussions.microsoft.com> scripsit:
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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #11

P: n/a

I think your looking for
Debug.Print in VB6
Micah

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #12

P: n/a
* Micah Armantrout <ma*********@gmail.com> scripsit:
I think your looking for
Debug.Print in VB6


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

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.