29 c# debugging asp.net-mvc visual-studio-2010 visual-studio
我的代码中有以下行:
System.Diagnostics.Debug.WriteLine("Title:" + title + "title[top]: " + title[top] + "title[sub]: " + title[sub]);
Run Code Online (Sandbox Code Playgroud)
当我调试时,我看到它会转到这一行,但当我在Visual Studio 2010中查看输出窗口时,即使它显示"Debug"并且我使用"debug> run"运行,我也看不到任何内容.为什么?
Al *_*ath 13
对我来说,这解决了这个问题:
System.Diagnostics.Trace.WriteLine("whatever");
Run Code Online (Sandbox Code Playgroud)
(用来Trace代替Debug)
在app.config文件中,确保<clear/>跟踪侦听器中没有元素.
您将有效地清除跟踪侦听器列表,包括用于Debug语句的默认跟踪侦听器.
以下是app.config文件中的内容:
<system.diagnostics>
<trace>
<listeners>
<!-- This next line is the troublemaker. If it is there delete it-->
<clear/>
</listeners>
</trace>
</system.diagnostics>
Run Code Online (Sandbox Code Playgroud)
对我来说,我需要这样做来解决问题:
1. Open the project's property page
2. Under Build tab, check "Define DEBUG constant" and "Define Trace constant"
Run Code Online (Sandbox Code Playgroud)
瞧!
| 归档时间: |
|
| 查看次数: |
38549 次 |
| 最近记录: |