Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

Poor WPF application performance due to UI Automation on certain machines

$
0
0


I am dealing with a performance issue an a WPF application that is related to UI Automation. 

The symptom:
On certain machines, expanding some expanders in our app can hang the app for minutes on end.  On other machines this operation is effectively instantaneous.

Attaching a debugger to the process when it is apparently hung reveals that WPF is executing deep recursive calls to UIElementHelper.InvalidateAutomationAncestors. Poking around in Reflector shows that UIElement.Measure will trigger a call to InvalidateAutomationAncestors if ContextLayoutManager.From(base.Dispatcher).AutomationEvents.Count != 0.  After setting some breakpoints when automation events are added shows that these AutomationEvents are added via the WPF toolip popup plumbing, when there are global Win32 event hooks registered for certain events.

So I guess my question boils down to:

1) Is there a way to protect my application so that UI Automation doesn't destroy its peformance? On the machine I was testing, it turned out that it was Norton Antivirus that had caused the bad interaction, but the number of programs that can trigger this behavior is apparently unbounded.

2) Could it be that we've somehow built our app such that we are triggering degenerate behavior when UIElementHelper.InvalidateAutomationAncestors runs? Any suggestions on how to identify something we may have done wrong?


Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>