我正在调试 Visual Studio (2010) Web 负载测试。当作为负载测试运行时,不能调试,只能作为“单一”测试。我想要 Console.WriteLine、Trace.WriteLine 或 Debug.WriteLine 之类的东西
有这样的内置功能还是我必须设置 log4net/nlog/whatever?
我正在调试 Visual Studio (2010) Web 负载测试。当作为负载测试运行时,不能调试,只能作为“单一”测试。我想要 Console.WriteLine、Trace.WriteLine 或 Debug.WriteLine 之类的东西
有这样的内置功能还是我必须设置 log4net/nlog/whatever?
Trace.WriteLine
应该可以工作 - 如果您以管理员身份从 Sysinternals(免费,可从 Microsoft 获得)运行 DebugView,我确实看到 Trace.WriteLine 被丢弃了。
我的示例代码:
using System.Diagnostics;
namespace ConsoleApplication1 {
internal class Program {
private static void Main ( string[] args ) {
Trace.WriteLine ( "xxxxxxxxxxxxxxxxxxxx" );
}
}
}
调试视图显示了这一点:
它显示了更多条目,因为 Visual Dtudio、驱动程序和可能其他应用程序也可能调用底层 API。因此,您可能想要使用过滤器或突出显示。
另一个提示:DebugView 捕获一台机器的输出。