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.
我以为我可以看看堆栈跟踪,但因为我使用的是INotifyPropertyChanged,我认为它并没有给我提供我正在寻找的全部信息。
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 bytesSystem.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字节
2 个解决方案
#1
Hmm. . .
嗯。 。 。
You can break point in your property setter and use Call Stack window to trace which one called it.
您可以在属性设置器中断点并使用“调用堆栈”窗口来跟踪调用它的那个。
#2
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.
这是一个有点旧的学校,但您是否尝试添加Debug.WriteLine()语句来跟踪您的程序执行?您可以在程序运行时在VS Output窗口中查看Debug.WriteLine()的结果。
#1
Hmm. . .
嗯。 。 。
You can break point in your property setter and use Call Stack window to trace which one called it.
您可以在属性设置器中断点并使用“调用堆栈”窗口来跟踪调用它的那个。
#2
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.
这是一个有点旧的学校,但您是否尝试添加Debug.WriteLine()语句来跟踪您的程序执行?您可以在程序运行时在VS Output窗口中查看Debug.WriteLine()的结果。