internal static object InvokeInDomain (AppDomain domain, MethodInfo method, object obj, object [] args)
{
AppDomain current = CurrentDomain;
bool pushed = false;
try {
Exception exc;
InternalPushDomainRef (domain);
pushed = true;
InternalSetDomain (domain);
object o = ((MonoMethod) method).InternalInvoke (obj, args, out exc);
if (exc != null)
throw exc;
return o;
}
finally {
InternalSetDomain (current);
if (pushed)
InternalPopDomainRef ();
}
}