简体   繁体   English

将C#类库加载到其自己的应用程序域中,并在发生异常时卸载而不会干扰第三方应用程序

[英]Load my C# class library in its own app domain and unload when exception occurs without disturbing third party application

I am createing plugins using c# class library, which can be loaded into third party application, but i want it to be loaded in its own app domain and unload when exception occurs in my code without affecting third party application process 我正在使用c#类库创建插件,该类库可以加载到第三方应用程序中,但是我希望将其加载到自己的应用程序域中,并在代码中发生异常时卸载,而不会影响第三方应用程序的过程

Here is the scenario, we have a third party application which allows to load plugins. 在这种情况下,我们有一个允许加载插件的第三方应用程序。 I am creating plugins, which can be loaded into this third party application. 我正在创建插件,可以将其加载到此第三方应用程序中。 but when it loads, by default it loads in its own app domain, but i want my plugin to be loaded in its own app domain with out affecting the third party process when an exception occurs in my plugin..Can you help me with the code to achieve the above requirement? 但是在加载时,默认情况下会在其自己的应用程序域中加载,但是我希望我的插件在其自己的应用程序域中加载,而不会在插件发生异常时影响第三方进程。代码达到以上要求?

The host application is what chooses the app domain to load the plugin. 主机应用程序是选择应用程序域来加载插件的工具。 If you don't control the host application, you can't control the app domain you're loaded into. 如果您不控制主机应用程序,则无法控制要加载到的应用程序域。 In theory, the app domain is irrelevant though: code your plugin such that exceptions don't bubble out of your classes, and you'll likely end up with much more durable, much better designed code. 从理论上讲,应用程序域是无关紧要的:对插件进行编码,以使异常不会从类中冒出来,并且最终可能会得到更加持久,设计更好的代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#窗口表单应用程序:是否可以在不使用任何第三方库的情况下将pdf转换为位图? - C# Window Form Application: Is there a way to convert pdf into bitmap without using any third party library? 无需使用第三方库即可转换为PDF的c#代码 - c# code for converting into PDF without using third party library 在不使用C#的第三方库的情况下将图像转换为PDF - Image to PDF conversion without using third party library in C# 我们可以在没有任何第三方工具的情况下通过 C# 应用程序在 whats 应用程序上发送消息吗? - Can we able to send messages on whats app through C# application without any third party tool? 从第三方应用程序调用类库时缺少MissingMethodException - MissingMethodException when calling to a class library from third-party application 没有第三方库的文本解析应用程序c# - text parsing application c# without third party libraries 在不使用第三方记录器的情况下登录C#应用程序 - Logging in C# application without using third party logger 如何在我的 C# 应用程序中调用第三方 exe? - How to call an third party exe within my C# application? 如何从具有自己的API(具有API Search EndPoint)的第三方数据库中加载数据,以使用我的Azure Web应用程序bot实施? - How do I load data from a third party database that has its own API (it has an API Search EndPoint) to implement with my azure web app bot? C#-从第三方库导入类并使其成为派生类(或类似的东西) - C# - import class from third-party library and make it a derived class (or something similar)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM