private void EnableLogging(bool sendToOutputWindow, string logFile) { try { MIDebugCommandDispatcher.EnableLogging(sendToOutputWindow, logFile); } catch (Exception e) { var commandWindow = (IVsCommandWindow)GetService(typeof(SVsCommandWindow)); commandWindow.Print(string.Format(CultureInfo.CurrentCulture, "Error: {0}\r\n", e.Message)); } }
private void EnableLogging(bool sendToOutputWindow, string logFile) { ThreadHelper.ThrowIfNotOnUIThread(); try { MIDebugCommandDispatcher.EnableLogging(sendToOutputWindow, logFile); } catch (Exception e) { var commandWindow = (IVsCommandWindow)GetService(typeof(SVsCommandWindow)); if (commandWindow != null) { commandWindow.Print(string.Format(CultureInfo.CurrentCulture, "Error: {0}\r\n", e.Message)); } else { throw new InvalidOperationException("Why is IVsCommandWindow null?"); } } }