hosting clr and catching threading exceptions

前端 未结 4 1838
梦毁少年i
梦毁少年i 2021-02-07 19:22

I am trying to write an plugin system that can load managed plugins. The host should be able to unload the plugins if there are any exceptions. for my poc I have a sample code

4条回答
  •  借酒劲吻你
    2021-02-07 19:57

    You can start a new AppDomain specifically for each given plugin and launch it inside. See http://msdn.microsoft.com/en-us/library/ms164323.aspx

    Each AppDomain is an isolated environment where code can execute. Exceptions occuring in one AppDomain can be isolated from th rest. See: http://msdn.microsoft.com/en-us/library/system.appdomain(v=VS.100).aspx

提交回复
热议问题