Cross AppDomain scoped static fields ?

Nov 9, 2008 at 8:40 PM
Hi all

What is the recommended way to have shared static field values that are accessible from all AddIns
whether they use their own AppDomain or not?

By default, static fields are scoped to AppDomains.  In other words, each AppDomain gets its own copy of all the static fields for the types that are loaded into that AppDomain.  This is independent of whether the code was loaded as domain-neutral or not.
One idea are RVA-based static fields that are process-global. But they are restricted to scalars and value types.
Are ther any code samples in C# how to create and access RVA-based static fields?

What about shared static class variables holding a singleton instance of some class?

Any help appreciated
Nov 19, 2008 at 12:24 AM
Hi s_orbit,

You could use your host to broker access to the statics, and store them in the host's AppDomain. This way they are available to any add-in, regardless of how it's activated (it even works out of process). How does this sound?

Nov 19, 2008 at 8:58 PM
Hi Mueez

Could you be more specific.
What do you mean by 'broker access'?

Currently I use the windows registry for simple types but have no solution for the rest.