0
Answer

Static CTor, App Domain, Remoting Issue

manicguitarist

manicguitarist

20y
1.7k
1
Here is the problem. I have two app domains - one of which hosts class A - shall we say, and the other class B. Now - class B has a static constructor that takes a while to initialise all the data - keeping the data in readonly static member data. This object is remoted - such that when the class is called it is instanced and it runs in AppDomain B - this is fine. So far so good. However, also - when it is remoted for the first time, the static CTor gets called from the calling domain as well - in effect the static CTor gets called once from each domain that calls it - and then once in the domain where the object actually exists. As the object only exists in one app domain - and everywhere else is just a proxy - I only want the static ctor being called once. Any ideas? M.