首页 文章

Debug.WriteLine没有在Visual Studio 2010中将输出写入OutputWindows

提问于
浏览
3

工具|选项|调试取消选中将所有输出重定向到立即 .
工具|选项|调试|输出窗口常规输出设置均为ON . 激活调试配置,检查定义DEBUG常量 .

仍然Debug.WriteLine(“test”)不向输出窗口写入任何内容(也不能在sysinternals的DebugView中捕获它) . 是什么导致的?

4 回答

  • 1

    在配置文件中有这个,希望可以帮助别人:

    <system.diagnostics>
        <trace>
          <listeners>
              <clear/>
          </listeners>
        </trace>
      </system.diagnostics>
    

    删除清楚,现在一切正常 . 谢谢@Hans Passant .

  • 2

    或使用此:

    System.Diagnostics.Debug.Listeners(0).WriteLine

    而不仅仅是Debug.WriteLine

  • 0

    我修复了关闭项目的问题,删除'bin'和'obj'文件夹 . 重新打开项目和Debug.WriteLine工作...

  • 2

    只是想对任何来这个问题的人说,给出的答案和收到的答案0,System.Diagnostics.Debug.Listeners(0).WriteLine在VS2013中为我工作 . 将console.writeLine和/或debug.WriteLine更改为上面的内容,打开您的即时窗口并输出 . 祝好运

相关问题