public static IScriptEnvironment Create(ScriptEnvironmentSetup setup, AppDomain domain) { Contract.RequiresNotNull(domain, "domain"); if (domain == AppDomain.CurrentDomain) { return(Create(setup)); } RemoteScriptEnvironment rse; if (!RemoteScriptEnvironment.TryCreate(domain, setup, out rse)) { throw new InvalidOperationException("Environment already created in the specified AppDomain"); } return(rse); }