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:
- AddinModule. Used to handle Excel events.
- RTDGeodesix. The RTD components
- 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:
- Building a Real Time Data for Excel server, part 1
- Building an Excel RTD: Avoiding VSTO, part 2
- Building an Excel RTD: How RTD servers work, part 3
- Building an Excel RTD: Architecture, part 4
- Building an Excel RTD: Excel, multithreading and callbacks, part 5
- Building an Excel RTD: Providing easy-to-read function names, part 6
- Building an Excel RTD: Talking to the GoogleMaps APIs, part 7
- Building an Excel RTD: Avoiding Application Domain misery, part 8
- Building an Excel RTD: Embedding a GoogleMap page in an Excel Task Pane, part 9
One Comment
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
CallRTD()
}
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();
}