Xander
Xander

Reputation: 9171

Debugging Property Settings in Visual Studio 2008 with INotifyPropertyChanged

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

Upvotes: 0

Views: 346

Answers (2)

James Cadd
James Cadd

Reputation: 12216

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.

Upvotes: 1

Marc Vitalis
Marc Vitalis

Reputation: 2249

Hmm. . .

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

Upvotes: 1

Related Questions