0

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. 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.

Community
  • 1
  • 1
blez
  • 4,939
  • 5
  • 50
  • 82

1 Answers1

2

You can't run an executable in another AppDomain. An executable means process and process means a different AppDomain. Think of running an executable as 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. You could reference this executable in your calling project or load the assembly dynamically at runtime.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • You cannot run an executable in another AppDomain. Executable means process. You can reference this executable in your calling application and then instantiate classes and run methods in a separate domain. Once you do Process.Start you are leaving the realm of your application and we can no longer talk about AppDomains. We are talking about processes. So you cannot just run an exe. You reference this exe in your calling project, instantiate its `Program` or whatever class is called and invoke the `Main` method on it. All this could happen in a separate AppDomain. – Darin Dimitrov Jul 16 '12 at 16:12