I've loaded a specific AppDomain up and I want to load some types dynamically from it (piece of cake right?). The thing is all of the CreateInstance methods of the AppDomain class return things as a remoting object handle. Remoting proxies have limitations that I would like to avoid such as: having to have serializable concrete classes, and over eager garbage collection unless LifeTimeService is used.
My Question is how can I load a type in another app domain without having it wrapped in a remoting proxy? Below is a snippet of my code.
AppDomainSetup ads = new AppDomainSetup();
ads.ApplicationBase = Path.GetDirectoryName(_bllAssemblyPath);
ads.PrivateBinPath = Path.GetDirectoryName(_bllAssemblyPath);
if (File.Exists(_bllAssemblyPath + ".config"))
ads.ConfigurationFile = _bllAssemblyPath + ".config";
_workerSpace= AppDomain.CreateDomain("worker", new System.Security.Policy.Evidence(AppDomain.CurrentDomain.Evidence), ads );
_bllQueue = _workerSpace.CreateInstanceFrom(_bllAssemblyPath, queueType) as IThumbCapQueue;