Maurice Calvert

Building a Real Time Data for Excel: Avoiding Application Domain misery, part 8

This is part 8 of the tutorial that describes the techniques necessary to build an Excel RTD server. If you have just come to this page, I suggest you read all parts in order, here is Building a Real Time Data for Excel, part 1.

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

There are 3 types of Add-in Express module used in Geodesix:

  1. AddinModule. Used to handle Excel events.
  2. RTDGeodesix. The RTD components
  3. ExcelAddinModule. 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 AddinModule 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.

Building a Real Time Data for Excel tutorial:

One Comment

  • vincent says:

    Hi Maurice, I had the same issue and I found something that appears to work until one is proving it does not :-)

    private void XLLModule1_OnInitialize(object sender, EventArgs e)
    so something

    with :

    public static string CallRTD()
    if (Module.IsInFunctionWizard)
    return “This UDF calls an RTD server.”;
    return Module.CallWorksheetFunction(AddinExpress.MSO.ADXExcelWorksheetFunction.Rtd, new object[3] { “Horizon.RTDServerModule1″, “”, “test” }).ToString();

Post a comment

Have any questions? Ask us right now!