I'm having the hardest time with this. I've googled for hours, and been to many different questions on here, but I just can't get it.
static void Main(string[] args)
{
AppDomainSetup domainSetup = new AppDomainSetup { PrivateBinPath = typeof(Program).Assembly.Location };
AppDomain domain = AppDomain.CreateDomain("TempDomain", null, domainSetup);
InstanceProxy proxy = domain.CreateInstanceFromAndUnwrap(typeof(Program).Assembly.Location, typeof(InstanceProxy).ToString()) as InstanceProxy;
if (proxy != null)
{
proxy.LoadAssembly(Properties.Resources.mfX3DAu);
}
AppDomain.Unload(domain);
Console.Read();
}
public class InstanceProxy : MarshalByRefObject
{
public void LoadAssembly(byte[] buffer)
{
Assembly asm = Assembly.Load(buffer);
asm.EntryPoint.Invoke(null, null);
}
}
The resource "mfX3DAu" is a .Net Assembly obfuscated with Confuser.
It loads fine, and it is in the new AppDomain, but every time I try and invoke it I get
An unhandled exception of type 'System.ExecutionEngineException' occurred
Someone I talked to before said they got it working with this specific assembly, so it must be possible.