private void InitializeCommon(AutomationEngine engine, PSHost hostInterface) { this._engine = engine; if (!_assemblyEventHandlerSet) { lock (lockObject) { if (!_assemblyEventHandlerSet) { AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ExecutionContext.PowerShellAssemblyResolveHandler); _assemblyEventHandlerSet = true; } } } this._debugger = new System.Management.Automation.Debugger(this); this.eventManager = new PSLocalEventManager(this); this.transactionManager = new PSTransactionManager(); this.myHostInterface = hostInterface as System.Management.Automation.Internal.Host.InternalHost; if (this.myHostInterface == null) { this.myHostInterface = new System.Management.Automation.Internal.Host.InternalHost(hostInterface, this); } this._assemblyCache = new Dictionary <string, Assembly>(); this._topLevelSessionState = this._engineSessionState = new SessionStateInternal(this); if (this._authorizationManager == null) { this._authorizationManager = new System.Management.Automation.AuthorizationManager(null); } this._modules = new ModuleIntrinsics(this); }
internal ExecutionContext(AutomationEngine engine, PSHost hostInterface, System.Management.Automation.Runspaces.RunspaceConfiguration runspaceConfiguration) { this.ignoreScriptDebug = true; this.logContextCache = new System.Management.Automation.LogContextCache(); this._questionMarkVariableValue = true; this._runspaceConfiguration = runspaceConfiguration; this._authorizationManager = runspaceConfiguration.AuthorizationManager; this.InitializeCommon(engine, hostInterface); }