WPF OnPropertyChanged ... what is slow??


I am trying to figure out how to profile a WPF application. I see that the slow down seems to be the OnPropertyChanged event and therefore I suspect that it is some data binding that is slow.

My question is how can I get to the details? Which listener is slowest? The methods mentioned in the Method list stops at the OnPropertyChanged method?

Any tips or pointers?



  • What happens when you create a "call graph" centered on theOnPropertyChanged method and the right-click and expand the call stack down? Does it show you further called methods?

    (The call graph view can be selected by clicking on the small blue/green/yellow icon that appears to the right of each method when clicked on).
  • OnPropertyChanged
    -> PropertyChangedEventManager.OnPropertyChanged
    -> WeakEventManager.DeliverEventToList
    -> PropertyPathWorker.ReceiveWeakEvent
    -> ClrBindingWorker.OnSourcePropertyChanged
    -> OnPropertyChangedAtLevel
    -> PropertyPathWorker.UpdateSourceValueState
    -> PropertyPathWorker.UpdateSourceValueState
    -> ClrBindingWorker.NewValueAvailable
    -> BindingExpression.TransferValue
    -> BindingExpression.Invalidate
    -> DependencyObject.InvalidateProperty
    -> DependencyObject.UpdateEffectiveValue
    -> (Simplified stack traces - ANTS Performance PRofiler has simplified child stack traces to reduce memory usage)
    -> last message repeats (lots of times)....

    Apparently it is some sort of binding but I have lots of bindings and it would be good to know which ones are taking the longest to update the value?
  • Hi Patrick,

    i'm assuming from your description that you haven't created the Call Graph that Chris was referring to.

    If you select the OnPropertyChanged method from the TreeView you will notice an icon appears in the selected row. If you create a call graph by clicking on that graph the view may reveal something a little more informative about the issue.

    The other point you raised about the simplified stack trace in the TreeView is a measure that we implemented to help reduce the impact of profiling on the performance of the application. This option can be turned off so that you see more methods (although the stack trace could be huge as a result) by going to Tools > Options prior to starting profiling and unchecking the "Simplify very complex stack traces to save memory" option. This may have a negative impact on profiling performance.


  • I did create the callgraph and this was the hierarchy I could see in the callgraph... will try unchecking the simplified stack trace option.
Sign In or Register to comment.