Avoiding Application Domain misery


This is a short but important subject (assuming you’re using Addin Express).

There are 3 types of Addin Express module used in GeodesiX:

  1. GeodesiXEXL. Used to handle Excel events.
  2. GeodesiXRTD. The RTD components
  3. GeodesiXUDF. The UDFs

The first two are loaded in the default Application Domain, the 3rd gets loaded when needed. If you let Excel load it, it gets loaded into a separate Application Domain, which means that the Common singleton gets created a second time and the modules are unable to share the cache.

We avoid this problem by pre-emptively calling Geocode when the GeodesiXEXL is initially loaded #26#. This forces the addin to load in the default domain.

I thought I was smarter and tried to find a way to share data amongst AppDomains. It’s not possible.

Update 6 April 2011: Cross-App-Domain data sharing is possible, by passing MarshalByRefObjects around with IPC. I have a working solution, but it’s not as stable as I would like. When it is, I’ll write it up on my blog.

 Posted by on 2011/04/07 at 19:13

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>