appdomain

MEF and ShadowCopying DLLs so that I can overwrite them at runtime

扶醉桌前 提交于 2020-01-01 08:19:09
问题 I am trying to stop my application locking DLLs in my MEF plugin directory so that I can overwrite the assemblies at runtime (note I'm not actually trying to have MEF reload them on the fly, at the next app start is fine, i just dont want to have to stop the app to do the copy) I am trying to do this by creating a shadow copied app domain for my mef loaded assemblies as below: [Serializable] public class Composer:IComposer { private readonly string _pluginPath; public Composer

MEF and ShadowCopying DLLs so that I can overwrite them at runtime

Deadly 提交于 2020-01-01 08:19:07
问题 I am trying to stop my application locking DLLs in my MEF plugin directory so that I can overwrite the assemblies at runtime (note I'm not actually trying to have MEF reload them on the fly, at the next app start is fine, i just dont want to have to stop the app to do the copy) I am trying to do this by creating a shadow copied app domain for my mef loaded assemblies as below: [Serializable] public class Composer:IComposer { private readonly string _pluginPath; public Composer

Loading DLLs into a separate AppDomain with known only common interface

允我心安 提交于 2020-01-01 06:33:25
问题 I need to load .dll(plugins) in another domain. In main app I don't know anything about plugins types, only that they implement common interface ICommonInterface with some methods. So this code wouldn't help, because I can't create an instance with interface type. AppDomain domain = AppDomain.CreateDomain("New domain name"); //Do other things to the domain like set the security policy string pathToDll = @"C:\myDll.dll"; //Full path to dll you want to load Type t = typeof(TypeIWantToLoad);

Load static class in appdomain

余生颓废 提交于 2019-12-30 07:06:12
问题 I'm met with a big problem in C# AppDomain. I need to load a static class in a .dll file and execute its method: When I try to load them by Assembly.LoadFrom("XXXXX") // (XXXXX is the full path of dll) the .dll will not be unload automatically or programmatically. When I try to load them in AppDomain like adapterDomain = AppDomain.CreateDomain("AdapterDomain"); (a)adapterDomain.CreateInstanceFrom(this.AdapterFilePath, this.AdapterFullName); (b)adapterAssembly=adapterDomain.Load(AssemblyName

Load static class in appdomain

余生长醉 提交于 2019-12-30 07:06:11
问题 I'm met with a big problem in C# AppDomain. I need to load a static class in a .dll file and execute its method: When I try to load them by Assembly.LoadFrom("XXXXX") // (XXXXX is the full path of dll) the .dll will not be unload automatically or programmatically. When I try to load them in AppDomain like adapterDomain = AppDomain.CreateDomain("AdapterDomain"); (a)adapterDomain.CreateInstanceFrom(this.AdapterFilePath, this.AdapterFullName); (b)adapterAssembly=adapterDomain.Load(AssemblyName

Load static class in appdomain

微笑、不失礼 提交于 2019-12-30 07:04:41
问题 I'm met with a big problem in C# AppDomain. I need to load a static class in a .dll file and execute its method: When I try to load them by Assembly.LoadFrom("XXXXX") // (XXXXX is the full path of dll) the .dll will not be unload automatically or programmatically. When I try to load them in AppDomain like adapterDomain = AppDomain.CreateDomain("AdapterDomain"); (a)adapterDomain.CreateInstanceFrom(this.AdapterFilePath, this.AdapterFullName); (b)adapterAssembly=adapterDomain.Load(AssemblyName

Passing values back and forth appdomains

◇◆丶佛笑我妖孽 提交于 2019-12-30 06:13:08
问题 I have the following code: public class AppDomainArgs : MarshalByRefObject { public string myString; } static AppDomainArgs ada = new AppDomainArgs() { myString = "abc" }; static void Main(string[] args) { AppDomain domain = AppDomain.CreateDomain("Domain666"); domain.DoCallBack(MyNewAppDomainMethod); Console.WriteLine(ada.myString); Console.ReadKey(); AppDomain.Unload(domain); } static void MyNewAppDomainMethod() { ada.myString = "working!"; } I thought make this would make my ada.myString

Mixing MarshalByRefObject and Serializable

 ̄綄美尐妖づ 提交于 2019-12-30 04:46:06
问题 Various sources explain that When an object derives form MarshalByRefObject, an object reference will be passed from one application domain to another rather than the object itself. When an object is marked with [Serializable], the object will be automatically serialized, transported from one application domain to another and then deserialized to produce an exact copy of the object in the second application domain. Note then that while MarshalByRefObject passes a reference, [Serializable]

How to pass an unknown type between two .NET AppDomains?

拥有回忆 提交于 2019-12-30 03:26:08
问题 I have a .NET application in which assemblies in separate AppDomains must share serialized objects that are passed by value. Both assemblies reference a shared assembly that defines the base class for the server class and also defines the base class for the entiy type that will be passed between domains: public abstract class ServerBase : MarshalByRefObject { public abstract EntityBase GetEntity(); } [Serializable] public abstract class EntityBase { } The server assembly defines the server

Load Current Assembly into different AppDomain

大兔子大兔子 提交于 2019-12-30 00:38:07
问题 I have created an AppDomain with a different base directory. However, I cannot seem to load the currently executing assembly into the other AppDomain without having a copy of the current executing assembly in the base directory. I've even tried to load it from the bytes. I get no exception when I try to load, but when I try to use: domain.DoCallBack(new CrossAppDomainDelegate(... I get: Could not load file or assembly ........... The system cannot find the file specified. My code is as