字典在 CLR 调试器 (DbgCLR) 中看起来很难看
字典值在 CLR 调试器中看起来很难看。有没有办法让他们看起来更友好?我只想查看键和值,而不是所有这些递归嵌套的属性。
UPD: 迄今为止发现的最佳权衡:
new ArrayList(myDictionary).ToArray()
Dictionary values look ugly in CLR Debugger. Is there a way to make them appear in more friendly way? I want to see just keys and values instead of all these recursively nested properties.
UPD: The best trade-off found so far:
new ArrayList(myDictionary).ToArray()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
关键是,当您说您只想查看键和值时,这意味着至少在这些对象中调用 ToString() ,并且如果您有一个 Student 类作为键,调试器不确定这是否真的是您所需要的例如,是否应该显示姓氏、名字或平均考试成绩?我不知道如果您最终重写了自己的类中的 ToString() 方法,调试器会表现如何,但只是为了让对象默认显示其可扩展层次结构。
the point is that when you say you only want to see keys and values, this implies at least a ToString() invocation in those objects and the Debugger is not sure this is really what you need, if you have a class Student as a key for example, should the last name or first name or average exam mark be shown? I do not know hoe the debugger would behave in case you have overridden the ToString() method in your own class, eventually, but just to make sire by default the objects are shown with their on expandable hierarchy.
您可以使用 DebuggerTypeProxy 属性来自定义类型的调试视图。
You can use a DebuggerTypeProxy attribute that allows you to customize a debug view of your type.
回答我自己的问题。
安装 Visual C# 2005 Express 后,情况变得好多了。现在,甚至自定义可视化工具也可以在 CLR 调试器中工作(感谢 @dkson 提及它们)!
Answering my own question.
Things got much better after installation of Visual C# 2005 Express. Now, even custom visualizers work in CLR Debugger (thanks @dkson for mentioning them)!