Teams keeps crashing in Citrix

A while ago I installed Teams in a client Citrix environment, I solved the large profile issue (Microsoft recommends 3 GB of free data for each user) with FSLogix, you can read more about that in my earlier blog-post here!

While testing Teams in the client test-environment it all worked flawlessly, I then proceeded to implement it in the production environment, it all worked great, Teams installed and worked as expected. Or so I thought…

The Problem

Next day I received multiple complaints about Teams hanging and restarting only to resume in a hanging state. In summary, it DID NOT WORK. Puzzled on why, since it still worked as expected in the test-environment I started to investigate. I started to check the Event viewer for any clues, there was none. I then proceeded to check the Teams install log (you can find it here: ”C:\Users\USERNAME\AppData\Local\SquirrelTemp\SquirrelSetup.log”, nothing to find here. I scavenged the internet for answers but always got the same solution: delete Teams and reinstall it. That did not work in my scenario. We also have 2 customers running this exact setup but without any issues. What I then started to suspect was the platform Citrix was running on, specifically virtual vs physical servers. All the installations on a virtual server worked, but on our physical server it did not.

Eventually I did a deep-dive to see what actually happens when it crashes and I discovered the following:

  1. When checking the Details tab in Task Manger I discovered that when Teams begins to be unresponsive a Werfault.exe (Windows Error Reporting) process starts and takes a lot o CPU resources but never quite finish.
  2. After investigating the Procmon I found something suspicious:
CtxGraphicHelper.dll

This is a Citrix Hook, used by Citrix to make program do stuff it was not programmed to do. Basically it’s used to make application work in a Citrix environment. If you want to know more on the subject please read this article explaining how it works!

3. After recovering this information I found a discussion on Reddit explaining my exact scenario, and a workaround for this specific issue. See below on how to apply the workaround.

Workaround

To get Teams to work on your Citrix environment if you experience this specific issue you need to exclude all Citrix Hooks from Teams.exe, you perform this by editing/adding the following registry value:

32-bit version:
HKLM\SOFTWARE\citrix\CtxHook\
String Value: ExcludedImageNames
Value: Teams.exe

64-bit version:
HKLM\SOFTWARE\WOW6432Node\citrix\CtxHook\
String Value: ExcludedImageNames
Value: Teams.exe

Note: The server need to restart for the changes to take affect!

Summary

This workaround is far from ideal, disabling the Citrix hooks is not recommended and can result in other issues with Teams. Please test it properly before making any organization-wide changes. And be aware that Teams has not yet been implemented in the HDX Optimazation pack, meaning it will not offload sound and video to your client. I’m sure Citrix is working hard to implement this as soon as possible.

I have not found the exact reason to why this is an issue and why it only seams to affect physical servers and not virtual. I suspect it’s the CtxGraphicHelper hook I discovered in the Procmon that might be the source to the problem. But it seams this workaround will get Teams to work just fine in your Citrix environment.

Please let me know if you have any questions or have anything to add!

Disclaimer: All information on this blog is offered "as is" with no warranty. It is strongly recommended that you verify all information and validate all scripts in isolated test environments before using them in production environments.