private void MakeConsole() { if (_nativeConsole == null) { try { // don't initialize in the constructor _nativeConsole = new NativeConsole(false); // this way, we can handle (report) any exception... _nativeConsole.Initialize(); _nativeConsole.WriteOutput += (source, args) => WriteNativeOutput(args.Text.TrimEnd('\n')); _nativeConsole.WriteError += (source, args) => WriteNativeError(args.Text.TrimEnd('\n')); } catch (ConsoleInteropException cie) { WriteNativeError("Couldn't initialize the Native Console: " + cie.Message); } } }