A Class A Day: System.ActivationContext

Astute readers would have noticed that when I started on my “class a day” journey that I missed out on the System._AppDomain interface and skipped straight to System.AccessViolationException. Thats because I am going to look at it when I look at the System.AppDomain class (notice the subtle difference there?) a little way down the track.

While I am at it I am going to excuse myself from talking about the Generic Action delegate which I have already given some coverage to. So what’s next? Answer – System.ActivationContext.

The ActivationContext class is a new addition to the .NET Framework in the 2.0 release and we have a quick look at the Callee Graph in Reflector we can see that it has something to do with ClickOnce deployment.

CalleeGraphActivationContext

Basically, the ActivationContext is available to applications that have been deployed by ClickOnce and give those applications access to important information such as where the application came from. This information is loaded out of the application manifest which is part of the set of files that are deployed to a server in order to support ClickOnce.

Developers don’t actually get a whole heap of access to the application manifest information from the ActivationContext class because the really interesting methods are marked as internal as the picture below generated from Reflector shows.

OverviewActivationContext

One thing that I thought was pretty amusing in the above listing was the internal inner enum called ApplicationStateDisposition. Way back when I used to do technical support I used to tell people that computers are just a machine, and they don’t hate their users, no matter how much you think that file corruption is a personal slight against them. Well – it looks like I was wrong.

Anyway – I think that the ActivationContext class like many of the classes that deal with deployment in the .NET Framework will provide useful diagnostic information for support staff. So what I would do is display something like the ApplicationIdentity attached as a property to the ActivationContext in some part of an About box – although ClickOnce kinda does that for free.

ApplicationIdentityForActivationContext

About these ads

2 thoughts on “A Class A Day: System.ActivationContext

  1. Ryan Trudelle-Schwarz

    Looks like you are mixing up activation and application in this entry, may want to double check that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s