D
da.3vil.coder
Guest
I have an application in which I want to create a new AppDomain to load and execute some plugins. However, I keep getting a serialization exception. This exception happens only when I provide an AppDomainSetup; this is required as I don't want the assemblies from my base app loading within the new AppDomain (which the are). This is due to the fact that the plugins could be using a different version of the same dlls.
Here's the code that I'm working with:
AppDomainSetup x = new AppDomainSetup();
x.ApplicationBase = @"C:\temp\";
AppDomain tempDomain = AppDomain.CreateDomain("TempDomain", null, x);
tempDomain.DoCallBack(() =>
{
Assembly assembly = Assembly.Load(File.ReadAllBytes(@"C:\temp\ClassLibrary1.dll"));
IProcess instance = (IProcess)assembly.CreateInstance("ClassLibrary1.Class1");
Data.Helpers.Interop.AddHooks(instance, instance.GetType());
instance.Execute();
});
AppDomain.Unload(tempDomain);
And here is the exception that I'm receiving:
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in ProcessScheduler.Test.exe
Additional information: Type is not resolved for member 'ProcessScheduler.Test.Program+<>c,ProcessScheduler.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Any help would be greatly appreciated.
Thanks,
Corey
Continue reading...
Here's the code that I'm working with:
AppDomainSetup x = new AppDomainSetup();
x.ApplicationBase = @"C:\temp\";
AppDomain tempDomain = AppDomain.CreateDomain("TempDomain", null, x);
tempDomain.DoCallBack(() =>
{
Assembly assembly = Assembly.Load(File.ReadAllBytes(@"C:\temp\ClassLibrary1.dll"));
IProcess instance = (IProcess)assembly.CreateInstance("ClassLibrary1.Class1");
Data.Helpers.Interop.AddHooks(instance, instance.GetType());
instance.Execute();
});
AppDomain.Unload(tempDomain);
And here is the exception that I'm receiving:
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in ProcessScheduler.Test.exe
Additional information: Type is not resolved for member 'ProcessScheduler.Test.Program+<>c,ProcessScheduler.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Any help would be greatly appreciated.
Thanks,
Corey
Continue reading...