/// <summary>Creates an instance of the application to be activated, using the specified activation context and custom activation data. </summary> /// <returns>An <see cref="T:System.Runtime.Remoting.ObjectHandle" /> that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object.</returns> /// <param name="activationContext">An <see cref="T:System.ActivationContext" /> that identifies the application to activate.</param> /// <param name="activationCustomData">Custom activation data.</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="activationContext" /> is null. </exception> public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData) { if (activationContext == null) { throw new ArgumentNullException("activationContext"); } AppDomainSetup adSetup = new AppDomainSetup(activationContext); return(ApplicationActivator.CreateInstanceHelper(adSetup)); }
public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData) { if (activationContext == null) { throw new ArgumentNullException("activationContext"); } if (CmsUtils.CompareIdentities(AppDomain.CurrentDomain.ActivationContext, activationContext)) { ManifestRunner manifestRunner = new ManifestRunner(AppDomain.CurrentDomain, activationContext); return(new ObjectHandle(manifestRunner.ExecuteAsAssembly())); } AppDomainSetup appDomainSetup = new AppDomainSetup(new ActivationArguments(activationContext, activationCustomData)); AppDomainSetup setupInformation = AppDomain.CurrentDomain.SetupInformation; appDomainSetup.AppDomainManagerType = setupInformation.AppDomainManagerType; appDomainSetup.AppDomainManagerAssembly = setupInformation.AppDomainManagerAssembly; return(ApplicationActivator.CreateInstanceHelper(appDomainSetup)); }