473,395 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Debug Mode

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
12 2557
* 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
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
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
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
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
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
* 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
* "=?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
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
* "=?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

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
* 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike C. Fletcher | last post by:
Every few months I get to working on a Python C extension (built with distutils) and discover a pointer error or the like where I'd like to be able to step into my DLL and see where the extension...
3
by: Max M. Power | last post by:
How can I tell if my C# code is running in debug mode? I need to execute some extra code only when my project has been compiled in debug mode. In release mode I don't want to execute this extra...
12
by: nospam | last post by:
All the documentation says that leaving an ASP.NET application in debug mode has a big performance hit. I can't detect any difference between debug and non-debug modes. Am I missing something or is...
7
by: Srinivasa Rao | last post by:
I have read in one article that when we compile the application in release mode, all the debug classes and properties will be automatically removed from the code. I tried to implement this thing by...
3
by: Rena | last post by:
Hi all, I have created a app. project and a library which will be used by the main project, however i do not know how to get into debug mode inside the library, although break point is set. is...
3
by: Haldun ALIML | last post by:
Suppose that you have below property in some class, #if DEBUG public string DebugInfo { get { return "INDEX : " + _name + "\n" + "Index Owner : " + _owner.Name + "\n" + "Index Column Count:...
6
by: pauldepstein | last post by:
To help me debug, I am writing a lot of information into a stream which I call debug. However, because of the large amount of time taken to print this information, I only want this printed while...
2
by: Dave Johansen | last post by:
I just converted a solution from Visual Studio 2003 to Visual Studio 2005 and the Debug mode seems to be running just fine, but the Release mode crashes on the following code: std::ifstream...
0
by: =?Utf-8?B?SmVmLnB0Yw==?= | last post by:
Hi, I am currently facing exactly the same issue with Visual Studio 2005. Did you find a way to solve this problem ? "AntonioSACE" wrote:
3
by: =?Utf-8?B?bG10dGFn?= | last post by:
We have developed a number of different applications (ASP.NET web site, Windows services, DLLs, Windows forms, etc.) in C# 2.0. We have developed and unit tested all these applications/components...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.