views:

202

answers:

2

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

+1  A: 

Hmm. . .

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

Marc Vitalis
It doesn't work with INotifyPropertyChanged
zachary
upon further review it looks like it was not my code invoking the property but the silverlight control instead
zachary
+1  A: 

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.

James Cadd