[英]How to run an executable from memory in another AppDomain?
I tried to find an example of this, but I found nothing. 我试图找到一个例子,但我一无所获。 Seems that CreateInstanceAndUnwrap and similar don't have overload for Assembly or byte array.
似乎CreateInstanceAndUnwrap和类似的没有Assembly或字节数组的重载。 Can someone tell me how to do this?
谁能告诉我怎么做?
EDIT: 编辑:
Here 's link to my other question. 这是我的另一个问题的链接。 My idea was to make a wrapper executable that runs my main executable and logs its errors.
我的想法是制作一个运行我的主要可执行文件并记录其错误的包装器可执行文件。 But I don't know how to catch AppDomain.FirstChanceException if I don't run it as another AppDomain.
但我不知道如果我不将它作为另一个AppDomain运行,如何捕获AppDomain.FirstChanceException。
You can't run an executable in another AppDomain. 您无法在另一个AppDomain中运行可执行文件。 An executable means process and process means a different AppDomain.
可执行意味着进程和进程意味着不同的AppDomain。 Think of running an executable as
Process.Start
. 考虑将可执行文件作为
Process.Start
运行。 So what you could do is to load the .NET assembly that this executable represents and invoke some method on it on another AppDomain. 所以你可以做的是加载这个可执行文件所代表的.NET程序集,并在另一个AppDomain上调用它上面的一些方法。 You could reference this executable in your calling project or load the assembly dynamically at runtime.
您可以在调用项目中引用此可执行文件,或在运行时动态加载程序集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.