为什么 System.Diagnostics.Debug.WriteLine 在 Visual Studio 2010 C# 中不起作用? [英] Why does System.Diagnostics.Debug.WriteLine not work in Visual Studio 2010 C#?

查看:20
本文介绍了为什么 System.Diagnostics.Debug.WriteLine 在 Visual Studio 2010 C# 中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码中有以下行:

System.Diagnostics.Debug.WriteLine("Title:" + title + "title[top]: " + title[top] + "title[sub]: " + title[sub]);

当我调试时,我看到它转到这一行,但是当我查看 Visual Studio 2010 中的输出窗口时,我看不到任何东西,即使它显示为调试"并且我使用调试 > 运行"运行".为什么?

When I debug I see it going to this line, but when I look at the output window in Visual Studio 2010 I don't see anything even though it shows for "Debug" and I ran using "debug > run". Why?

推荐答案

检查以下项目 -

  1. DEBUG 调试时选择了模式
  2. Debug 选项在输出窗口中被选中 -
  3. 查看断点是否命中代码中的 Debug.WriteLine
  4. 在代码开头插入Debug.AutoFlush = true
  5. 尝试检查解决方案的平台是否设置为任何 CPU 而不是 x86(或 x64).
  6. 转到项目属性--> Web - 在调试器部分,选中 ASP.NET 选项
  1. DEBUG mode is selected while debugging
  2. Debug option is selected in Output window -
  3. See if breakpoint is hitting Debug.WriteLine in code
  4. Insert Debug.AutoFlush = true at the beginning of code
  5. Try checking if Platform for the solution is set to Any CPU and not x86 (or x64).
  6. Goto Project Properties--> Web - In the Debugger section, check the the ASP.NET option

参考 第 5 点(阅读评论,对那个人有用)

Reference for Point #5 (Read the comment, It worked for that guy)

这篇关于为什么 System.Diagnostics.Debug.WriteLine 在 Visual Studio 2010 C# 中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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