{"id":249,"date":"2011-04-07T19:13:28","date_gmt":"2011-04-07T19:13:28","guid":{"rendered":"http:\/\/www.calvert.ch\/geodesix\/?page_id=249"},"modified":"2011-04-08T12:09:44","modified_gmt":"2011-04-08T12:09:44","slug":"avoiding-application-domain-misery","status":"publish","type":"page","link":"https:\/\/www.calvert.ch\/geodesix\/help\/source-code\/avoiding-application-domain-misery\/","title":{"rendered":"Avoiding Application Domain misery"},"content":{"rendered":"<p>This is a short but important subject (assuming you&#8217;re using Addin Express).<\/p>\n<p>There are 3 types of Addin Express module used in GeodesiX:<\/p>\n<ol>\n<li>GeodesiXEXL. Used to handle Excel events.<\/li>\n<li>GeodesiXRTD. The RTD components<\/li>\n<li>GeodesiXUDF. The UDFs<\/li>\n<\/ol>\n<p>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.<\/p>\n<p>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.<\/p>\n<p><del>I thought I was smarter and tried to find a way to share data amongst AppDomains. It&#8217;s not possible. <\/del><\/p>\n<p>Update 6 April 2011: Cross-App-Domain data sharing is possible, by passing <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.marshalbyrefobject.aspx\">MarshalByRefObject<\/a>s around with <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.runtime.remoting.channels.ipc.aspx\">IPC<\/a>. I have a working solution, but it&#8217;s not as stable as I would like. When it is, I&#8217;ll write it up <a href=\"http:\/\/www.calvert.ch\/maurice\">on my blog<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a short but important subject (assuming you&#8217;re using Addin Express). There are 3 types of Addin Express module used in GeodesiX: GeodesiXEXL. Used to handle Excel events. GeodesiXRTD. The RTD components GeodesiXUDF. The UDFs The first two are <a href='https:\/\/www.calvert.ch\/geodesix\/help\/source-code\/avoiding-application-domain-misery\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":247,"menu_order":7,"comment_status":"open","ping_status":"closed","template":"momoframepage.php","meta":{"footnotes":""},"class_list":["post-249","page","type-page","status-publish","hentry","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/pages\/249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/comments?post=249"}],"version-history":[{"count":6,"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/pages\/249\/revisions"}],"predecessor-version":[{"id":321,"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/pages\/249\/revisions\/321"}],"up":[{"embeddable":true,"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/pages\/247"}],"wp:attachment":[{"href":"https:\/\/www.calvert.ch\/geodesix\/wp-json\/wp\/v2\/media?parent=249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}