Home > 2012

2012

WPF – Flickering Screen on Citrix

Wednesday, September 5, 2012 0



Problem Statement:

Flickering screen observed with WPF applications being run over Citrix. 

Symptoms:

  1. Screen flicker 
  2. Mouse Flicker
  3. System unresponsive
  4. Mouse stuck/unresponsive
  5. Process has to be ended through Task Manager

Cause:

WPF writes some images/bitmaps to a cache in root drive. These images/bitmaps are used by Citrix while displaying the UI to the user. If the user that is currently logged in does not have sufficient permissions to write these bitmaps in the root drive, flickering takes place.

Solution(s):

  1. Assign permissions to the affected user.
  2. Login with a user that has sufficient permissions – ONCE. App will work correctly for all future logins of any user since cache is now written.
  3. Apply hotfix from Microsoft.
More information on this issue is available at:
http://support.microsoft.com/kb/955692

WPF UI Optimization: Identifying the Rendering Tier

Friday, August 3, 2012 Category : , , , , 0

When a WPF application is run, WPF checks the underlying hardware as well as software (read DirectX) to determine the best way of processing everything. So, if DirectX is installed, video buffer settings are as required, graphics card is functional and drivers are installed, WPF uses hardware acceleration for rendering. All the non-rendering processing happens at the CPU level while all the rendering related processing is delegated to the GPU. This is the ideal scenario, in most cases, in which a WPF application performs well.

In some cases though, based on what it finds, the WPF engine reverts to using software rendering, which may not be ideal except in cases where the graphics card is old or if the capabilities are low. In software rendering, the rendering related processing is not performed at the GPU level and is instead performed at the CPU level.

To be able to troubleshoot performance issues with a WPF application, the first question that comes to mind is whether the WPF application actually used the shining graphics card and latest software we put into the system. This can be found out by checking the Rendering Tier being used by the application.

For any WPF application, it is important to log the rendering tier that is being used at the client running the application. Rendering tier can be obtained in C# using the following code:

System.Windows.Media.RenderCapability.Tier >> 16

As per MSDN, System.Windows.Media.RenderCapability.Tier is “An Int32 value whose high-order word corresponds to the rendering tier for the current thread”. So we shift it by 16 bits and get the value.

A detailed explanation of the various rendering Tiers is available here. Though in short:

Rendering Tier 0: No graphics hardware acceleration

Rendering Tier 1: Partial graphics hardware acceleration

Rendering Tier 2: Most graphics features use graphics hardware acceleration

WPF UI Optimization: Freezable and Static Resources

Thursday, August 2, 2012 Category : , , , 0


I'm sure if you are maintaining or developing a WPF application, you would have (or would, sometime in the future) face performance issues when your application runs on machines that are just not good enough for it – read WinXP, RDC versions below 7.0, Citrix...

So if you are stuck with any of those, you would definitely face issues from your app running slow to even the mouse being held captive as flickering ensues.

This is the first tip in a series of tips that will follow: use frozen and static resources in your styles as much as possible. The only reason to use dynamic resources is if those resources are going to change at runtime or if the values of these resources can only be evaluated at runtime. For everything that won’t change and can be evaluated before the code actually runs, use static resources.

The reason behind this is simple. WPF stops monitoring these resources for changes and also stores them in the cache. Hence, there is a considerable improvement in performance. Tried and tested.

Powered by Blogger.