Application causes Screen Flickering in Citrix XenApp Session

Yesterday I was asked to troubleshoot an interesting issue with an application running on Citrix XenApp.

Environment
This customer is running Citrix XenApp 5 on Windows Server 2003 (x86). On the Client Side the Online Plugin version 12.3 is used.

The Problem
When this particular application was active the screen was flickering and black blocks appeared at seemingly random places. Further more it was not possible to resize the window:

image

My experience is that display issues are often related to either HDX Flash Redirection (offloading flash to the client) or the Multi Monitor hook.

 

HDX Flash Redirection
XenApp allows us to selectively enable or disable HDX Flash Redirection per URL by using either a whitelist or a blacklist. This is usually done with a GPO.

I first tested if the issue was caused by HDX Flash Redirection by simply starting the session from within an RDP session but the problem still occurred.

Multi Monitor Hook
When you are using multiple monitors with Citrix XenApp both screens are actually one big screen with the XenApp session. XenApp then uses a hook mechanism (DLL Injection) to simulate multiple monitors.

Without these hooks you will for example notice that an application doesn’t start on one of the monitors but on all or is centered on them.

To quickly test if this issue was caused by the Multi Monitor hook I configured the ExcludeImageNames registry key as described in CTX107825 which disables all hooks.

Since the problem still occurred I concluded the issue was not caused by the hooks.

Windows Presentation Foundation
Because I needed to find the process names for the afore mentioned ExcludedImageNames key I noticed that there was a process called Presentationhost.exe:

image

A google search for Presentationhost.exe tells us that it’s the host process for Windows Presentation Foundation (WPF) applications that are hosted in a browser.

Hotfix
So my next search was “Windows Presentation Foundation Screen Flicker” and the first hit was Microsoft kb955692: “Your screen flickers when you start WPF applications in a Windows Server 2003 terminal server session”.

  • The hotfix from the article addresses an issue with WPF applications
    You use a non-administrator user account to connect to a Windows Server 2003-base terminal server by using a third-party terminal client, such as a Citrix ICA client.
  • You run Windows Presentation Foundation (WPF) applications in the terminal server session.

The hotfix fixes the issue however:

Considering that WPF and the related ClickOnce Deployment were meant to enable users without administrative privileges to install and run web applications this is really a stoopid bug, in summary: WPF applications fail without write permissions in the %windir%\system32 folder!

ClickOnce
ClickOnce is an even bigger disaster in SBC because for every user the whole application (6 MegaBytes in this case) is downloaded into %userprofile%\Local Settings\Apps:

image

This not only means that every user gets a copy of the application (which is bad enough in it’s self) but because the path is into Local Settings it means that every user gets a copy on each server he/she logs into!