如何让 SysInternals DebugView 显示缩进?
我正在将 SysInternals DebugView 与我的 .Net 应用程序一起使用。我尝试过使用 .Net Debug 类的缩进功能,但 DebugView 似乎只是将其表示为 NewLine 字符。
有谁知道是否可以让 DebugView 显示缩进?
示例代码:
static void Main (string[] args)
{
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Indent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Indent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Indent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Unindent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Unindent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Unindent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
}
输出:
[9632] Indent level: 0
[9632]
[9632] Indent level: 1
[9632]
[9632]
[9632] Indent level: 2
[9632]
[9632]
[9632]
[9632] Indent level: 3
[9632]
[9632]
[9632] Indent level: 2
[9632]
[9632] Indent level: 1
[9632] Indent level: 0
我想看到的内容:
[9632] Indent level: 0
[9632] Indent level: 1
[9632] Indent level: 2
[9632] Indent level: 3
[9632] Indent level: 2
[9632] Indent level: 1
[9632] Indent level: 0
Rik
I'm using SysInternals DebugView with my .Net application. I've tried using the Indent feature of the .Net Debug class, but DebugView just seems to represent this as a NewLine character.
Does anyone know if it's possible to get DebugView to display the indents?
Sample Code:
static void Main (string[] args)
{
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Indent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Indent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Indent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Unindent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Unindent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
Debug.Unindent();
Debug.WriteLine("Indent level: {0}", Debug.IndentLevel);
}
Output:
[9632] Indent level: 0
[9632]
[9632] Indent level: 1
[9632]
[9632]
[9632] Indent level: 2
[9632]
[9632]
[9632]
[9632] Indent level: 3
[9632]
[9632]
[9632] Indent level: 2
[9632]
[9632] Indent level: 1
[9632] Indent level: 0
What I'd Like to see:
[9632] Indent level: 0
[9632] Indent level: 1
[9632] Indent level: 2
[9632] Indent level: 3
[9632] Indent level: 2
[9632] Indent level: 1
[9632] Indent level: 0
Rik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
但是等等!看起来是有可能的。您只需在选项菜单上关闭强制回车功能即可。
我在这里找到了答案:
http://forum.sysinternals.com/topic26797_post131196.html#131196
这是文本:
But wait! It looks like it is possible. You just need to turn off the Force Carriage Returns feature on the Options menu.
I discovered the answer here:
http://forum.sysinternals.com/topic26797_post131196.html#131196
Here's the text:
我认为你不能让 DebugView 这样做。它捕获单独的输出写入,因此当您执行 Debug.WriteLine 时,调试类将缩进空间单独输出为单独的 OutputDebugString 调用。您仍然可以做的就是自己添加缩进空间,并将您的写入映射到单个底层 API 调用中:
I don't think you can make DebugView do this way. It captures individual output writes, so it seems that when you do
Debug.WriteLine
Debug class outputs indentation space individually as separateOutputDebugString
calls. What you definitely still can do is adding indentation space yourself and have your writes mapped into single underlying API calls: