Single Instance Winform in Citrix published application by ThinqLinq

Single Instance Winform in Citrix published application

About a year ago I one of the first blog posts I wrote related to Single Instance Winform applications. While these are much easier to do with VB 2005, I didn't expect to run into issues with it after it was working fine for a year. In our production environment, my current company uses Citrix with Terminal Services to serve the desktop to all users. We have one application which we wanted to serve out as a published application. We set it up and it appeared to work fine. As deployments go, it worked fine until an end user got their hands on it.

Citrix requires a low latency connection in order to keep the connection active. If a user's connection is erratic, they Citrix will sense that they are disconnected and drop the session to the end user. Their session is kept active on the server however. This causes the first instance to continue running on the server even though it is not running on the client. Normally, a user would just be able to log back into their existing session.

Unknown to me, our network support changed the Citrix configuration to only allow one instance of an application to be running at a time. Normally, this would be fine. However, if you are using a single instance Winform application, the single instance is not truly what happens under the covers. To avoid rehashing the previous post, I will simply state here that a second instance of the application is temporarily initiated and sends notification to the first instance that it is being started again and then closes the second instance bringing the first instance back to the foreground. Unfortunately, since the Citrix published application was set to only allow for a single instance of the application, the second temporary instance was blocked and the user was notified that they couldn't log in again (even if they were just trying to re-establish a dropped session).

Long story short. If you are using Single Instance Winform applications in VB 2005, don't enable the allow single instance for a published application instance in Citrix as well. I only lucked upon the solution to this one this time. Hopefully, this post can help someone out there suffering from the same issue.

Posted on - Comment
Categories: VB) -
comments powered by Disqus