We have an excel plugin that works fine and we have nothing to use for AppDomains .
However, it seems that some other plugin makes our code load a second time, and we end up with our code working on two different AppDomains (when we want to perform some action, we will put it in the queue for AppDomain 1, and then the Excels OnTime function runs the dequeue method on AppDomain 2, where the queue is empty).
So my question is this: is there an easy way around this problem, perhaps to prevent our program from loading twice or by other AppDomains ? Does anyone have any other idea on how to approach this problem?
Update:
We managed to load our entire program into another AppDomain plugin when we called, and now we have the weirdest problem in the same places (places that used to be โgateways to other domainsโ like the mentioned action queue function):
SynchronizationContext.Current seems to reset to null when there is such a case, for example, for each call to the click handler on the ribbon, SynchronizationContext.Current is set to null.
I even tried to debug the .Net code, and it happens that the structure remembers the old synchronization context, and when everything returns to how things are, the old synchronization context is null.
Can someone help in this matter, am I really starting to lose it?
Dejan maksimovic
source share