/// <summary> /// Creates a <see cref="ShellScope"/> on this shell context. /// </summary> public ShellScope CreateScope() { // Don't create a shell scope on a released shell. if (_released) { return(null); } var scope = new ShellScope(this); // Don't start using a new scope on a released shell. if (_released) { // But let this scope manage the shell state as usual. scope.TerminateShellAsync().GetAwaiter().GetResult(); return(null); } return(scope); }