使用 INotifyPropertyChanged 调试 Visual Studio 2008 中的属性设置

发布于 2024-07-23 12:30:10 字数 1462 浏览 2 评论 0原文

我有一个类,其属性由另一个类设置。 在这个属性设置器中,程序崩溃了。

我只需要知道哪个类实际设置了该属性。

我以为我可以只查看堆栈跟踪,但因为我正在使用 INotifyPropertyChanged,所以我认为它没有提供我正在寻找的完整信息。

如果这有帮助的话,这是堆栈跟踪:

    MyProject!MyProject.MyClass.MyProperty.set(string value = "") Line 24   C#
[Native to Managed Transition]  
[Managed to Native Transition]  
System.Windows.dll!System.Windows.CLRPropertyListener.Value.set(object value = "") + 0x58 bytes 
System.Windows.dll!System.Windows.PropertyAccessPathStep.Value.set(object value = "") + 0x28 bytes  
System.Windows.dll!System.Windows.PropertyPathListener.LeafValue.set(object value = "") + 0x28 bytes    
System.Windows.dll!System.Windows.Data.BindingExpression.UpdateValue() + 0x26c bytes    

System.Windows.dll!System.Windows.Data.BindingExpression.TargetTextBoxLostFocus(对象发件人 = {System.Windows.Controls.TextBox}, System.Windows.RoulatedEventArgs e = {System.Windows.RoulatedEventArgs}) + 0x55 字节
System.Windows.dll!System.Windows.CoreInvokeHandler.InvokeEventHandler(int typeIndex = 160,System.Delegate handlerDelegate = {System.Windows.RoulatedEventHandler},对象发送者 = {System.Windows.Controls.TextBox},对象 args = {System .Windows.RoatedEventArgs}) + 0x6b3 字节 System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj = 173934552,System.IntPtr unmanagedObjArgs = 273432032,int argsTypeIndex = 160,字符串eventName =“M@2910”) + 0x335字节

I have a class with a property that gets set by another class. Inside this property setter the program blows up.

I just need to know what class actually set the property.

I thought I could just look at the stacktrace, but because I am using INotifyPropertyChanged I think it doesn't give me the full information I am looking for.

Here is the stack trace if this helps:

    MyProject!MyProject.MyClass.MyProperty.set(string value = "") Line 24   C#
[Native to Managed Transition]  
[Managed to Native Transition]  
System.Windows.dll!System.Windows.CLRPropertyListener.Value.set(object value = "") + 0x58 bytes 
System.Windows.dll!System.Windows.PropertyAccessPathStep.Value.set(object value = "") + 0x28 bytes  
System.Windows.dll!System.Windows.PropertyPathListener.LeafValue.set(object value = "") + 0x28 bytes    
System.Windows.dll!System.Windows.Data.BindingExpression.UpdateValue() + 0x26c bytes    

System.Windows.dll!System.Windows.Data.BindingExpression.TargetTextBoxLostFocus(object sender = {System.Windows.Controls.TextBox}, System.Windows.RoutedEventArgs e = {System.Windows.RoutedEventArgs}) + 0x55 bytes
System.Windows.dll!System.Windows.CoreInvokeHandler.InvokeEventHandler(int typeIndex = 160, System.Delegate handlerDelegate = {System.Windows.RoutedEventHandler}, object sender = {System.Windows.Controls.TextBox}, object args = {System.Windows.RoutedEventArgs}) + 0x6b3 bytes
System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj = 173934552, System.IntPtr unmanagedObjArgs = 273432032, int argsTypeIndex = 160, string eventName = "M@2910") + 0x335 bytes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

离不开的别离 2024-07-30 12:30:12

这有点老派,但是您是否尝试过添加 Debug.WriteLine() 语句来跟踪程序执行? 当程序运行时,您可以在 VS 输出窗口中查看 Debug.WriteLine() 的结果。

It's a little old school, but have you tried adding Debug.WriteLine() statements to trace your program execution? You can view the results of Debug.WriteLine() in the VS Output window while your program runs.

丶情人眼里出诗心の 2024-07-30 12:30:11

唔。 。 。

您可以在属性设置器中断点,并使用“调用堆栈”窗口来跟踪哪个调用者调用了它。

Hmm. . .

You can break point in your property setter and use Call Stack window to trace which one called it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文