簡體   English   中英

使用INotifyPropertyChanged在Visual Studio 2008中調試屬性設置

[英]Debugging Property Settings in Visual Studio 2008 with INotifyPropertyChanged

我有一類具有由另一個類設置的屬性。 在此屬性設置器中,程序會崩潰。

我只需要知道實際上哪個類設置了屬性。

我以為我可以看一下堆棧跟蹤,但是因為我使用的是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.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,字符串eventName =“ M @ 2910” )+ 0x335字節

嗯。

您可以在屬性設置器中斷點,並使用“調用堆棧”窗口來跟蹤哪個調用它。

它有點老了,但是您是否嘗試過添加Debug.WriteLine()語句來跟蹤程序執行? 程序運行時,可以在“ VS輸出”窗口中查看Debug.WriteLine()的結果。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM