public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
{
if (activationContext == null)
{
throw new ArgumentNullException("activationContext");
}
Contract.EndContractBlock();
if (CmsUtils.CompareIdentities(AppDomain.CurrentDomain.ActivationContext, activationContext))
{
ManifestRunner runner = new ManifestRunner(AppDomain.CurrentDomain, activationContext);
return(new ObjectHandle(runner.ExecuteAsAssembly()));
}
AppDomainSetup adSetup = new AppDomainSetup(new ActivationArguments(activationContext, activationCustomData));
// inherit the calling domain's AppDomain Manager
AppDomainSetup currentDomainSetup = AppDomain.CurrentDomain.SetupInformation;
adSetup.AppDomainManagerType = currentDomainSetup.AppDomainManagerType;
adSetup.AppDomainManagerAssembly = currentDomainSetup.AppDomainManagerAssembly;
// we inherit the evidence from the calling domain
return(CreateInstanceHelper(adSetup));
}