哪里Debug.Write()输出到?Debug、Write

2023-09-03 11:03:32 作者:或许我不懂你つ

我没有看到控制台或VS输出面板任何输出

I didn't see any output in console or VS output panel from

Debug.Write(WriteStatements()达到)

在什么地方输出去?

感谢。

推荐答案

它写入默认跟踪监听器,你就需要打开:

It writes to the default trace listener, which you would need to turn on:

Debug.Write方法

如果您希望此定向到控制台,您将需要添加的一个实例ConsoleTraceListener:

If you want this directed to the console you would need to add an instance of the ConsoleTraceListener:

在你的config文件确保您有以下条目:

In your .config file ensure you have the following entries:

<configuration>
  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <add name="configConsoleListener" 
          type="System.Diagnostics.ConsoleTraceListener" />
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>

您可能还需要确保你已经包括了 / D:TRACE 标记编译您的项目,以使输出的时候

You may also need to ensure that you've included the /d:TRACE flag when compiling your project to enable the output.