PC Review


Reply
 
 
Micah
Guest
Posts: n/a
 
      23rd Aug 2004
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
 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      23rd Aug 2004
* (E-Mail 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'

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
 
Reply With Quote
 
Brian Henry
Guest
Posts: n/a
 
      23rd Aug 2004
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]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>* (E-Mail 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'
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



 
Reply With Quote
 
Micah Armantrout
Guest
Posts: n/a
 
      23rd Aug 2004
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!
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      23rd Aug 2004
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/>
 
Reply With Quote
 
Micah Armantrout
Guest
Posts: n/a
 
      23rd Aug 2004
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!
 
Reply With Quote
 
=?Utf-8?B?eHBpbmc=?=
Guest
Posts: n/a
 
      23rd Aug 2004
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/>
>

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      23rd Aug 2004
* "=?Utf-8?B?eHBpbmc=?=" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      23rd Aug 2004
* Micah Armantrout <(E-Mail Removed)> 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/>
 
Reply With Quote
 
=?Utf-8?B?eHBpbmc=?=
Guest
Posts: n/a
 
      26th Aug 2004
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=?=" <(E-Mail Removed)> 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/>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My application takes up 1.5GB of memory in release mode, but only 370mb in debug mode...why? John Sheppard Microsoft Dot NET 4 16th Jan 2008 11:16 AM
My application takes up 1.5GB of memory in release mode, but only 370mb in debug mode...why? John Sheppard Microsoft VB .NET 4 16th Jan 2008 11:16 AM
User Control access fails in debug mode, works in release mode rbg Microsoft C# .NET 0 17th Jan 2007 10:51 PM
User Control access fails in debug mode, works in release mode rbg Microsoft ASP .NET 0 17th Jan 2007 10:51 PM
How to tell if your C# code is running in debug mode (debug compil =?Utf-8?B?TWF4IE0uIFBvd2Vy?= Microsoft C# .NET 3 20th Oct 2005 10:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:41 PM.