/// <summary> /// Ported from void global_scope_t::report_error(const std::exception& err) /// </summary> public void ReportError(Exception ex) { VirtualConsole.Output.Flush(); // first display anything that was pending if (!CancellationManager.IsCancellationRequested) { // Display any pending error context information string context = ErrorContext.Current.GetContext(); if (!String.IsNullOrWhiteSpace(context)) { VirtualConsole.Error.WriteLine(context); } VirtualConsole.Error.WriteLine(String.Format("Error: {0}", ex.Message)); } else { CancellationManager.DiscardCancellationRequest(); } }
public void CancellationManager_DiscardCancellationRequest_RestoresDefaultSignalValue() { MainApplicationContext.Current.CancellationSignal = CaughtSignalEnum.INTERRUPTED; CancellationManager.DiscardCancellationRequest(); Assert.Equal(CaughtSignalEnum.NONE_CAUGHT, MainApplicationContext.Current.CancellationSignal); }