ThrowPromptNotInteractive(string promptMessage) { string message = StringUtil.Format(HostInterfaceExceptionsStrings.HostFunctionPromptNotImplemented, promptMessage); HostException e = new HostException( message, null, "HostFunctionNotImplemented", ErrorCategory.NotImplemented); throw e; }
ThrowNotInteractive() { // It might be interesting to do something like // GetCallingMethodAndParameters here and display the name, // but I don't want to put that in mainline non-trace code. string message = HostInterfaceExceptionsStrings.HostFunctionNotImplemented; HostException e = new HostException( message, null, "HostFunctionNotImplemented", ErrorCategory.NotImplemented); throw e; }
private void ThrowPromptNotInteractive(string promptMessage) { HostException exception = new HostException(StringUtil.Format(HostInterfaceExceptionsStrings.HostFunctionPromptNotImplemented, promptMessage), null, "HostFunctionNotImplemented", ErrorCategory.NotImplemented); throw exception; }
internal void ThrowNotInteractive() { HostException exception = new HostException(HostInterfaceExceptionsStrings.HostFunctionNotImplemented, null, "HostFunctionNotImplemented", ErrorCategory.NotImplemented); throw exception; }
/// <summary> /// Helper function to create the proper HostException /// </summary> /// <param name="win32Error"></param> /// <param name="errorId"></param> /// <param name="category"></param> /// <param name="resourceStr"></param> /// <returns></returns> private static HostException CreateHostException( int win32Error, string errorId, ErrorCategory category, string resourceStr) { Win32Exception innerException = new Win32Exception(win32Error); string msg = StringUtil.Format(resourceStr, innerException.Message, win32Error); HostException e = new HostException(msg, innerException, errorId, category); return e; }
private static HostException CreateHostException(int win32Error, string errorId, ErrorCategory category, string resourceStr) { Win32Exception win32Exception = new Win32Exception(win32Error); string str = StringUtil.Format(resourceStr, win32Exception.Message, win32Error); HostException hostException = new HostException(str, win32Exception, errorId, category); return hostException; }
public int Start(string consoleFilePath, string[] args) { int num; string message; Guid activityId = EtwActivity.GetActivityId(); if (activityId == Guid.Empty) { EtwActivity.SetActivityId(EtwActivity.CreateActivityId()); } PSEtwLog.LogOperationalInformation(PSEventId.Perftrack_ConsoleStartupStart, PSOpcode.WinStart, PSTask.PowershellConsoleStartup, PSKeyword.UseAlwaysOperational, new object[0]); WindowsErrorReporting.RegisterWindowsErrorReporting(false); try { Thread.CurrentThread.CurrentUICulture = NativeCultureResolver.UICulture; Thread.CurrentThread.CurrentCulture = NativeCultureResolver.Culture; RunspaceConfigForSingleShell runspaceConfigForSingleShell = null; PSConsoleLoadException pSConsoleLoadException = null; if (!string.IsNullOrEmpty(consoleFilePath)) { runspaceConfigForSingleShell = RunspaceConfigForSingleShell.Create(consoleFilePath, out pSConsoleLoadException); } else { ConsoleHost.DefaultInitialSessionState = InitialSessionState.CreateDefault2(); runspaceConfigForSingleShell = null; if (Process.GetCurrentProcess().MainWindowHandle != IntPtr.Zero) { ConsoleHost.DefaultInitialSessionState.WarmUpTabCompletionOnIdle = true; } } int num1 = 0; try { RunspaceConfigForSingleShell runspaceConfigForSingleShell1 = runspaceConfigForSingleShell; string shellBanner = ManagedEntranceStrings.ShellBanner; string shellHelp = ManagedEntranceStrings.ShellHelp; if (pSConsoleLoadException == null) { message = null; } else { message = pSConsoleLoadException.Message; } num1 = ConsoleShell.Start(runspaceConfigForSingleShell1, shellBanner, shellHelp, message, args); } catch (HostException hostException1) { HostException hostException = hostException1; if (hostException.InnerException != null && hostException.InnerException.GetType() == typeof(Win32Exception)) { Win32Exception innerException = hostException.InnerException as Win32Exception; if (innerException.NativeErrorCode == 6 || innerException.NativeErrorCode == 0x4d4) { num = num1; return(num); } } WindowsErrorReporting.FailFast(hostException); } catch (Exception exception1) { Exception exception = exception1; WindowsErrorReporting.FailFast(exception); } num = num1; } finally { WindowsErrorReporting.WaitForPendingReports(); } return(num); }