Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
971 views
in Technique[技术] by (71.8m points)

.net - WPF performance issue due to UI Automation

I'm experiencing an issue described in this thread.

dotTrace told me "Stylus Input" was guilty. enter image description here

I tried the code posted by Ron Z and Chaim Zonnenberg, but didn't work.

Rash suggested 2 workarounds:

  1. Automation code will be triggered only if there are any automation clients ( like screen reader, tabtip in tablet pcs, etc) running in the machine. So one way to get out of this situation is to close any of those automation client apps.

  2. If one is not feasible then an alternative is, UIElementHelper.InvalidateAutomationAncestors will take longer time only if automation tree for the app is sparse ( happens if had disabled building automation tree using custom window automation peer) and visual tree is dense. So another solution is disable any custom automation code and allow WPF to build complete automation tree. This should speed up UIElementHelper.InvalidateAutomationAncestors as well.

But how to close tabtip? I tried to stop and disable the following services but didn't work, tabtip.exe was still running in the background:

  • Tablet PC Input Service
  • TabletServicePen

Rash said this issue should be solved in .NET 4.0 SP1. Anyone knows the release date of .NET 4.0 SP1?

I'm using Visual Studio 2010, Windows 7 64bit, Wacom Graphire 4.

Thanks


Update:

To close tabtip.exe I just need to restart Windows after disabling the aforementioned services. But this alone didn't solve my issue. In order to workaround the performance issue, I have to also disable "Wacom Consumer Touch Service".

And according to this thread (March 22, 2011):

there is no published timeline for .NET Framework 4.0 sp1

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I recently had to deal with this exact problem using a WPF tool on our project.

The machine where the crash was happening is running .NET Framework 4.5.

When the tool was crashing we could see the crash happening in .NET PresentationFramework UIAutomation. The crash exception was: A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in PresentationFramework.dll --> at this point the bug appeared to be in .NET Framework

But then we could see down the stack that we crashed in a UIAutomation call, that lead us to this thread and figured that this module is being trigger by the Wacom services.

The Wacom driver running on the machine where the app is crashing was: Wacom Tablet 6.3.1w3 After downgrading to the previous version everything started working: WacomTablet_6.3.3-4

Now that we knew the source of the problem we started looking into a workaround to be able to still use the latest driver. So here it is and what's nice is that it don’t seem to affect the wacom tablet functionality: - Go to Control Panel. - Double click on Programs and Features - Click on the link on the left titled Turn Windows Features on or off - When that loads, uncheck ‘Tablet PC Optional Components’ (Might be called ‘Tablet PC Components’ in Windows 7). - Click the OK button. This might require you to restart your windows machine.

And that did the trick for us.

Have fun!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...