.net 我们可以在 WPF 中调试 Xaml 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3155435/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can we Debug Xaml in WPF?
提问by sag
Can we Debug Xaml in WPF? Is there any external tool or VS plugin which can do that?
我们可以在 WPF 中调试 Xaml 吗?是否有任何外部工具或 VS 插件可以做到这一点?
采纳答案by IanR
I've occassionally found these tricks here useful...
我偶尔发现这些技巧在这里很有用......
http://www.wpftutorial.net/DebugDataBinding.html
http://www.wpftutorial.net/DebugDataBinding.html
...particularly the second one where you use a dummy value converter to break in to the debugger. It's useful for seeing exactly what objects are being bound, etc.
...尤其是第二个,您使用虚拟值转换器进入调试器。这对于准确查看正在绑定的对象等很有用。
回答by akjoshi
I don't agree with others that it's not possible to debug XAML, but it's true that there are no powerful tools available for this.
我不同意其他人无法调试 XAML 的观点,但确实没有强大的工具可用于此。
As Mark says in this post - http://markegilbert.wordpress.com/2008/03/15/debugging-xaml/
正如马克在这篇文章中所说 - http://markegilbert.wordpress.com/2008/03/15/debugging-xaml/
So, the simple answer is yes, you can debug problems with XAML. The longer, more qualified answer is that while it's possible, the support isn't terribly robust yet but should improve with newer dev environments (Visual Studio, Expression Blend, etc.).
因此,简单的答案是肯定的,您可以使用 XAML 调试问题。更长、更合格的答案是,虽然有可能,但支持还不是非常强大,但应该会随着更新的开发环境(Visual Studio、Expression Blend 等)而改进。
Tips on how to debug and learn about WPF(Josh Smith): http://joshsmithonwpf.wordpress.com/2007/03/29/tips-on-how-to-debug-and-learn-about-wpf/
关于如何调试和了解 WPF 的提示(Josh Smith):http: //joshsmithonwpf.wordpress.com/2007/03/29/tips-on-how-to-debug-and-learn-about-wpf/
Wayback Link| Get line numbers of XAML issues (Peter Himschoot):
回溯链接| 获取 XAML 问题的行号 (Peter Himschoot):
Simply add this to your project file:
<!-- under the <PropertyGroup> tag --> <XamlDebuggingInformation>true</XamlDebuggingInformation>Now we at least get line number information on the problem :)
只需将其添加到您的项目文件中:
<!-- under the <PropertyGroup> tag --> <XamlDebuggingInformation>true</XamlDebuggingInformation>现在我们至少得到了关于这个问题的行号信息:)
More descriptive XAML exception details (Rob Relyea)
更具描述性的 XAML 异常详细信息 (Rob Relyea)
More on XamlParseException (Laurent Bugnion)
更多关于 XamlParseException (Laurent Bugnion)
Wayback Link| XAML Runtime Parsing Exceptions (c/o Erno de Weerd)
回溯链接| XAML 运行时解析异常 (c/o Erno de Weerd)
Wayback Link| How to debug triggers using Trigger-Tracing(Dan Lamping)
回溯链接| 如何使用触发器跟踪(Dan Lamping)调试触发器
Debugging Dynamic XAML in Silverlight (Julia Lerman)
在 Silverlight 中调试动态 XAML (Julia Lerman)
Just use google/StackOverflow to know how to debug specific XAML issues.
只需使用 google/StackOverflow 即可了解如何调试特定的 XAML 问题。
回答by Darin Dimitrov
XAML is a declarative language and not imperative so I don't see how debugging it could be possible.
XAML 是一种声明性语言而不是强制性的,所以我不知道如何调试它是可能的。
回答by Ragunathan
No it is not possible.
不,这是不可能的。


