调试模式 [英] Debug Mode

查看:81
本文介绍了调试模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来判断程序是否在调试中编译

模式,我希望我写的应用程序向QA吐出一条消息

如果发生错误并且它处于调试模式,但是如果它处于发布状态,那么我希望它能够将错误保留给自己。有没有办法做到这一点

如果是这样的话?


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

推荐答案

* ma*********@gmail.com (Micah)scripsit:
* ma*********@gmail.com (Micah) scripsit:
我正在寻找一种方法来判断程序是否以调试模式编译,我希望我正在编写的应用程序向QA吐出一条消息
如果出错如果它处于调试模式,但是如果它处于发布模式,我希望它将错误保留在自身。有没有办法做到这一点
如果是这样的话?
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如果

///


- 和/或 -


''System.Diagnostics.Debugger.IsAttached''


-

MS Herfried K. Wagner

MVP< URL :http://dotnet.mvps.org/>

VB< URL:http://dotnet.mvps.org/dotnet/faqs/>



\\\
#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/>


如果使用编译器常量,那么它是否正确?如果设置了该常量,它只会将代码编译到应用程序中?不像

,如果你问是否附加了调试器,那将是每个

编译...只是想指出这是一个可能的问题,如果他们期望

如果使用编译器常量

版本,则编译到应用程序中的代码。

" Herfried K. Wagner [MVP]" ; <喜*************** @ gmx.at>在消息中写道

news:2o ************ @ uni-berlin.de ...
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:
* ma*********@gmail.com (Micah) scripsit:
我是寻找一种方法来判断程序是否以调试模式编译,我希望我正在编写的应用程序向QA吐出一条消息如果发生错误并且是否处于调试模式,但是如果它处于发布模式,我希望它能够将错误保留给自己。有没有办法做到这一点
如果是这样的话?
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那么
Console.WriteLine(& ;调试模式。)
#Else
Console.WriteLine(发布模式。)
#End如果
///
- 和/或 -

''System.Diagnostics.Debugger.IsAttached''

- MS Herfried K. Wagner
MVP< ; URL:http://dotnet.mvps.org/>
VB< URL:http://dotnet.mvps.org/dotnet/faqs/>



\\\
#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/>



关键字 - if语句中的DEBUG也不能在表达式中使用,

''System.Diagnostics.Debugger.IsAttached''

表示像interdev这样的调试器是附加的,QA没有

Interdev在机器上附加它,我只想知道
知道它是不是是否在调试模式下完成。也许

''System.Diagnostics.Debugger.IsAttached''是我正在寻找的但是我想b / b
如果Interdev被附加到这个过程那么想?

Micah

\\\

#If DEBUG然后

Console.WriteLine("调试模式。)

#Else

Console.WriteLine(发布模式。)

#End如果

///

***通过开发人员指南 http: //www.developersdex.com ***

不要只是参加USENET ......获得奖励!
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!


这篇关于调试模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆