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(object sender = {System.Windows.Controls.TextBox}, System.Windows.RoutedEventArgs e = {System.Windows.RoutedEventArgs}) + 0x55 字节
System.Windows .dll!System.Windows.CoreInvokeHandler.InvokeEventHandler(int typeIndex = 160,System.Delegate handlerDelegate = {System.Windows.RoutedEventHandler},对象发送者 = {System.Windows.Controls.TextBox},对象 args = {System.Windows。 RoutedEventArgs}) + 0x6b3 字节 System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj = 173934552, System.IntPtr unmanagedObjArgs = 273432032, int argsTypeIndex = 160, string eventName = "M@2910") + 0x335字节

4

2 回答 2

1

唔。. .

您可以在属性设置器中断点并使用调用堆栈窗口来跟踪调用它的那个。

于 2009-06-15T17:36:00.867 回答
1

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

于 2009-06-15T18:31:17.413 回答