Dll heaven: Executing multiple versions of the same assembly
New* .NET 3.5 Feature: AddIn Framework Resources (Part 2 of 2)

New* .NET 3.5 Feature: AddIn Framework ( Part 1 of 2 )

2ne of the new items that were included in the .NET 3.5 framework is a built in way to add extensibility to your application using add-ins, also known as plug-in. Many of us have already added extensibility in our own application using interfaces. However this framework comes with a few built in features for addin lifetime management, security isolations etc.

Sandbox Isolation

If we want to add termination features to an addin we would need to load it to to different appdomain since we may want to unload it or reload it when any error happens. Also when the addin runs in a separate domain space it is less likely to corrupt any part of the application.


Please also note that when an addin is unloaded, the unloading causes the other assemblies to be unloaded as well on which the addin is dependent upon. This happens because the AppDomain is unloaded.


The new framework also supports discovery of addins within a folder. Also you can also search for a certain addin. According to the documentation each addin has its own folder and its own set of assemblies.


The security of the sandboxed addin can be created when we create the application domain for the addin to run on or we can even use the policy level security to control the addin behavior.


Versioning is provided via contract isolation, both the addin host and the addin itself can version independently of each other. A concept of adapter assembly is present for both the add in and the host so that the implementation can change independently.


Due to running the addin in different AppDomain boundary termination of the AppDomain automatically clears memory and all other resources. However if we needed to do this manually then we would have to find the application domain that hosts the assembly and unload it. The framework provides a nifty class to unload the addin and its AppDomain



Related Post:

Dll heaven: Executing multiple versions of the same assembly

kick it on DotNetKicks.com



Nice post, thanks for introducing this argument.
Maybe in the future you could add some practical examples about best practices related to this feature :)


Ok, sorry, obviously today I'm blind :)
I totally missed the "Next" paragraph ;)

Shafqat Ahmed

Yes, I am working on that ... will be in the next post


Hey, your 'Next' link is broken, or at least it doesn't work in IE. I looked at the source and for some reason you have two 'a' tags one inside the other, and only the outer one has the href=http://www.shafqatahmed.com/2008/01/new-net-35-fe-1.html, so the actual link (using the inner tag, with no URL) goes nowhere.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment

Comments are moderated, and will not appear until the author has approved them.

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)