Serialization when Add-in is created in Host's App Domain

May 28, 2009 at 5:33 PM

I am curious about the performance of System.Addin.  I understand why members defined in the contract would need to be serializable if the host and addin are in separate app domains or processes.  Does the serialization still happen if the add-in is in the same app domain as the host?  It seems to me that serialization is significantly slower than a direct / shared memory access. 

What about MEF?  Does MEF have to use serialization to pass data between host and plug-in?

Jun 5, 2009 at 7:31 PM

I wrote some tests for this and it turns out that no serialization happens when the add-in is loaded into the same app domain as the host.  There is still some overhead because data still needs to be converted.  In my tests serialization over the app domain boundry is 4 times slower than just converting between types in the same app domain.

Jun 5, 2009 at 10:13 PM

Hiya,

As far as I understand, MEF is just linking up dlls within one and the same app domain. This is what the team responded on a similar questions before.

Serialization happens for serializable types. You can use MarshalByRefObject to marshal the pointer instead, although there are still the overhead of security which takes time, referred to as the "constant penalty of crossing the app domain" from some people's blogs (add in team's).