private void CreateAppDomain()
 {
     try
     {
         appDomain = AppDomainUtils.CreateAppDomain(@"IsolatedAppDomainHost",
                                                    HostSetup.ApplicationBaseDirectory, temporaryConfigurationFilePath, HostSetup.ShadowCopy);
     }
     catch (Exception ex)
     {
         throw new HostException("Could not create the isolated AppDomain.", ex);
     }
 }
        /// <inheritdoc />
        protected override IRemoteHostService AcquireRemoteHostService()
        {
            try
            {
                SetWorkingDirectory();
                CreateTemporaryConfigurationFile();
                CreateAppDomain();
                AttachDebuggerIfNeeded(debuggerManager, Process.GetCurrentProcess());

                var endpoint = (IsolatedAppDomainEndpoint)AppDomainUtils.CreateRemoteInstance(appDomain, typeof(IsolatedAppDomainEndpoint));

                foreach (string hintDirectory in HostSetup.HintDirectories)
                {
                    endpoint.AddHintDirectory(hintDirectory);
                }

                return(endpoint.CreateRemoteHostService(null));
            }
            catch (Exception)
            {
                FreeResources();
                throw;
            }
        }