Sharing Types between AppDomains
I am currently developing an add-in system for a program I am writing, and have run into the issue of how the host and add-in should communicate on a common base. I use the System.AddIn
namespace (previously called the MAF) for discovery, isolation, and activation of add-ins.
Now, since I want (need?) add-ins to exist in separate AppDomains from the host, there exists the problem that types cannot be开发者_StackOverflow中文版 shared between AppDomains and thus not between host and add-in. I understand there is some built-in support for type marshalling between AppDomains, but know nothing about this, nor whether it is even appropriate.
So the question is, what can I do if I want to share the same object (instance) between add-in and host in two separate app-domains? Perhaps there is a more subtle way around this problem?
So it seems MarshalByRefObject
and a few functions on the AppDomain object provides the basis for exactly what I want. Case closed for now, I think.
精彩评论