void FileLoader_GetFileAsTextFailed(object sender, ExceptionEventArgs e) { if (e.Exception != null) OnGetConnectionsFailed(new ExceptionEventArgs(e.Exception, e.UserState)); else OnGetConnectionsFailed(new ExceptionEventArgs(new Exception(Resources.Strings.ExceptionUnknownError), e.UserState)); }
internal bool OnCallbackException(Exception exception) { var args = new ExceptionEventArgs(exception); OnCallbackException(args); return args.Handled; }
protected virtual void OnException(ExceptionEventArgs e) { if (this.Exception != null) { this.Exception(this, e); } }
protected void Arrange() { var random = new Random(); _subsystemName = random.Next().ToString(CultureInfo.InvariantCulture); _operationTimeout = TimeSpan.FromSeconds(30); _encoding = Encoding.UTF8; _disconnectedRegister = new List<EventArgs>(); _errorOccurredRegister = new List<ExceptionEventArgs>(); _errorOccurredEventArgs = new ExceptionEventArgs(new SystemException()); _sessionMock = new Mock<ISession>(MockBehavior.Strict); _channelMock = new Mock<IChannelSession>(MockBehavior.Strict); _sequence = new MockSequence(); _sessionMock.InSequence(_sequence).Setup(p => p.CreateChannelSession()).Returns(_channelMock.Object); _channelMock.InSequence(_sequence).Setup(p => p.Open()); _channelMock.InSequence(_sequence).Setup(p => p.SendSubsystemRequest(_subsystemName)).Returns(true); _subsystemSession = new SubsystemSessionStub( _sessionMock.Object, _subsystemName, _operationTimeout, _encoding); _subsystemSession.Disconnected += (sender, args) => _disconnectedRegister.Add(args); _subsystemSession.ErrorOccurred += (sender, args) => _errorOccurredRegister.Add(args); _subsystemSession.Connect(); }
private void BitmapDownloadFailed(object sender, ExceptionEventArgs e) { var bitmap = (BitmapSource)sender; bitmap.DownloadCompleted -= BitmapDownloadCompleted; bitmap.DownloadFailed -= BitmapDownloadFailed; Image.Source = null; }
public void ExceptionEventArgs_Unit_BubbleException_True() { Exception exception = new ApplicationException("This is a test.").AsThrown(); ExceptionEventArgs target = new ExceptionEventArgs(exception); Boolean value = true; target.BubbleException = value; Assert.AreEqual(value, target.BubbleException); }
protected virtual void onThrowException(ExceptionEventArgs e) { EventHandler<ExceptionEventArgs> handler = ThrowException; if(handler != null) { handler(this, e); } }
void bmp_DownloadFailed(object sender, ExceptionEventArgs e) { BitmapFrame bmp = (BitmapFrame)sender; var id = downloadingTiles[bmp]; downloadingTiles.Remove(bmp); UnsubscribeBitmapEvents(bmp); bmp.Freeze(); ReportFailure(id); }
private void BitmapDownloadFailed(object sender, ExceptionEventArgs e) { var bitmap = (BitmapSource)sender; bitmap.DownloadCompleted -= BitmapDownloadCompleted; bitmap.DownloadFailed -= BitmapDownloadFailed; ((MapImage)Children[currentImageIndex]).Source = null; BlendImages(); }
void FileLoader_FileLoadFailed(object sender, ExceptionEventArgs e) { if (e.Exception != null) { OnGetConfigurationStoreFailed(new ExceptionEventArgs(e.Exception, e.UserState)); } else { OnGetConfigurationStoreFailed(new ExceptionEventArgs(new Exception(Resources.Strings.ExceptionUnknownError), e.UserState)); } }
/// <summary> /// Handles non-fatal errors by writing a message describing the exception or /// failure to stderror. /// </summary> /// <param name="sender">Source of the error</param> /// <param name="e">Specifics of the exception or failure</param> internal static void OnNonFatalError(Object sender, ExceptionEventArgs e) { if (e.Exception != null) { Console.Error.WriteLine("Non-fatal exception: {0}", e.Exception.Message); } else { Console.Error.WriteLine("Non-fatal failure: {0}", e.Failure.Message); } }
public void ExceptionEventArgs_Integration_Serialization_Optimal() { Exception exception = new ApplicationException("This is a test.").AsThrown(); Boolean bubbleException = true; ExceptionEventArgs original = new ExceptionEventArgs(exception, bubbleException); ExceptionEventArgs clone = original.SerializeBinary(); Assert.AreNotSame(original, clone); Assert.AreEqual(original.BubbleException, clone.BubbleException); Assert.AreEqual(original.Exception.GetType(), clone.Exception.GetType()); Assert.AreEqual(original.Exception.Message, clone.Exception.Message); Assert.AreEqual(original.Exception.StackTrace, clone.Exception.StackTrace); }
private static void LocalCrashHandler(object sender, ExceptionEventArgs args) { var exception = args.ErrorException; var recoverable = exception as RecoverableException; if(recoverable != null) { MessageDialog.ShowError(args.ErrorException.Message); } else { MessageDialog.ShowWarning(args.ErrorException.ToString()); } }
protected virtual void OnBackgroundOpenReadAsyncFailed(ExceptionEventArgs args) { if (BackgroundOpenReadAsyncFailed != null) { if (ESRI.ArcGIS.Client.Extensibility.MapApplication.Current != null) { ESRI.ArcGIS.Client.Extensibility.MapApplication.Current.Dispatcher.BeginInvoke((Action)delegate { BackgroundOpenReadAsyncFailed(this, args); }); } else BackgroundOpenReadAsyncFailed(this, args); } }
void SymbolConfigProvider_GetDefaultSymbolFailed(object sender, ExceptionEventArgs e) { GraphicsLayer layer = e.UserState as GraphicsLayer; if (layer == null) return; if (Core.LayerExtensions.GetRunLayerPostInitializationActions(layer)) { PerformPostLayerInitializationActions(layer, true); Core.LayerExtensions.SetRunLayerPostInitializationActions(layer, false); return; } AddLayer(layer, true, null); }
void FileLoader_FileLoadFailed(object sender, ExceptionEventArgs e) { object[] userState = (e.UserState as object[]); if (userState == null || userState.Length < 2) return; EventHandler<ExceptionEventArgs> onFailed = userState[2] as EventHandler<ExceptionEventArgs>; if (onFailed == null) return; if (e.Exception != null) { onFailed(this, new ExceptionEventArgs(e.Exception, userState[0])); } else { onFailed(this, new ExceptionEventArgs(new Exception(Resources.Strings.ExceptionUnknownError), e.UserState)); } }
void Runtime_UnhandledException(object sender, ExceptionEventArgs args) { switch (args.Severity) { case ExceptionSeverityLevel.Info: EventLog.WriteEntry(args.Exception.ToString(), EventLogEntryType.Information); break; case ExceptionSeverityLevel.Warning: EventLog.WriteEntry(args.Exception.ToString(), EventLogEntryType.Warning); break; case ExceptionSeverityLevel.Error: EventLog.WriteEntry(args.Exception.ToString(), EventLogEntryType.Error); break; case ExceptionSeverityLevel.Fatal: EventLog.WriteEntry(args.Exception.ToString(), EventLogEntryType.FailureAudit); break; } }
public override void OnException(HttpActionExecutedContext context) { var e = new ExceptionEventArgs(context.Exception); this.OnException(e); if (e.Handled) { var error = new HttpError(e.Message); error["ReturnCode"] = e.ReturnCode; context.Response = context.Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, error); } else { var error = new HttpError(context.Exception, true); context.Response = context.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, error); } }
void debuggedProcess_ExceptionThrown(object sender, ExceptionEventArgs e) { if (!e.IsUnhandled) { // Ignore the exception e.Process.AsyncContinue(); return; } JumpToCurrentLine(); StringBuilder stacktraceBuilder = new StringBuilder(); // Need to intercept now so that we can evaluate properties if (e.Process.SelectedThread.InterceptCurrentException()) { stacktraceBuilder.AppendLine(e.Exception.ToString()); string stackTrace; try { stackTrace = e.Exception.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.EndOfInnerException}")); } catch (GetValueException) { stackTrace = e.Process.SelectedThread.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}"), StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}")); } stacktraceBuilder.Append(stackTrace); } else { // For example, happens on stack overflow stacktraceBuilder.AppendLine(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Error.CannotInterceptException}")); stacktraceBuilder.AppendLine(e.Exception.ToString()); stacktraceBuilder.Append(e.Process.SelectedThread.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}"), StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}"))); } string title = e.IsUnhandled ? StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Title.Unhandled}") : StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Title.Handled}"); string message = string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Message}"), e.Exception.Type, e.Exception.Message); Bitmap icon = WinFormsResourceService.GetBitmap(e.IsUnhandled ? "Icons.32x32.Error" : "Icons.32x32.Warning"); DebuggeeExceptionForm.Show(debuggedProcess, title, message, stacktraceBuilder.ToString(), icon); }
protected virtual async Task HandleRemotePeerAsync(RemoteTcpPeer remoteTcpPeer, CancellationToken cancellationToken) { try { await this.ReceiveFromRemotePeerAsync(remoteTcpPeer, cancellationToken).ConfigureAwait(false); } catch (OperationCanceledException ex) { if (!cancellationToken.IsCancellationRequested) { remoteTcpPeer.ConnectionCloseReason = ConnectionCloseReason.Timeout; } else { remoteTcpPeer.ConnectionCloseReason = ConnectionCloseReason.LocalShutdown; } remoteTcpPeer.ConnectionCloseException = ex; } catch (Exception ex) { remoteTcpPeer.ConnectionCloseReason = ConnectionCloseReason.ExceptionOccured; remoteTcpPeer.ConnectionCloseException = ex; var ue = new ExceptionEventArgs(ex); this.OnUnhandledException(ue); } this.RemoveRemoteTcpPeerFromConnectedList(remoteTcpPeer.IPEndPoint); var connectionClosedEventArgs = new ConnectionClosedEventArgs(remoteTcpPeer) { ConnectionCloseException = remoteTcpPeer.ConnectionCloseException, ConnectionCloseReason = remoteTcpPeer.ConnectionCloseReason }; this.OnConnectionClosed(remoteTcpPeer, connectionClosedEventArgs); }
protected virtual void OnFrameArrived(RemoteTcpPeer remoteTcpPeer, TcpFrameArrivedEventArgs e) { try { remoteTcpPeer.OnFrameArrived(e); } catch (Exception ex) { var ue = new ExceptionEventArgs(ex); this.OnUnhandledException(ue); } try { this.FrameArrived?.Invoke(this, e); } catch (Exception ex) { var ue = new ExceptionEventArgs(ex); this.OnUnhandledException(ue); } }
protected virtual void OnConnectionClosed(RemoteTcpPeer remoteTcpPeer, ConnectionClosedEventArgs e) { try { remoteTcpPeer.OnConnectionClosed(e); } catch (Exception ex) { var ue = new ExceptionEventArgs(ex); this.OnUnhandledException(ue); } try { this.ConnectionClosed?.Invoke(this, e); } catch (Exception ex) { var ue = new ExceptionEventArgs(ex); this.OnUnhandledException(ue); } }
private void GetMetadataFail(ExceptionEventArgs args) { // TODO: Centralize button text buttonScan.Text = "Scan"; if (IsCancellationRequested) { AppendStatus("Metadata search canceled!"); _taskbarItem.NoProgress(); } else { AppendStatus("Metadata search failed!"); _taskbarItem.Error(); } if (args.Exception != null) { ShowExceptionDetail("Error: Metadata Search Failed", args.Exception); } EnableControls(true); }
/// <summary> /// Handles the <see cref="UpdateManager.VersionCheckError" /> event of a <see cref="UpdateManager" /> instance and /// manages the dialog handling and downloads the update if requested. /// </summary> /// <commondoc select='All/Methods/EventHandlers[@Params="Object,+EventArgs"]/*' /> private void UpdateManager_VersionCheckError(object sender, ExceptionEventArgs e) { if (e.IsHandled) { return; } if (e.Exception is WebException) { DialogManager.ShowUpdate_UnableToConnect(this.MainWindow); e.IsHandled = true; return; } if (e.Exception is FormatException) { if (DialogManager.ShowUpdate_UpdateFileNotFound(this.MainWindow)) { Process.Start(AppEnvironment.WebsiteUrl); } e.IsHandled = true; } }
private void mediaCenter_AsyncStopEnd(object sender, ExceptionEventArgs e) { if (InvokeRequired) { BeginInvoke(new EventHandler <ExceptionEventArgs>(mediaCenter_AsyncStopEnd), sender, e); return; } SetStatusText(false); if (this.afterStopped == AfterStopped.Close) { Application.Exit(); } else if (this.afterStopped == AfterStopped.LoadSettings) { ApplySettings(); StartMediaCenterAsync(); } else { SetButtonEnabled(true); } }
private void OnMediaFailed(object sender, ExceptionEventArgs args) { this._element.OnMediaFailed(sender, args); }
/// <summary> /// Called when an error occurs. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ExceptionEventArgs"/> instance containing the event data.</param> void OnError(object sender, ExceptionEventArgs e) { if (_isConsole) { Console.Error.WriteLine(e.Exception); // Also log to event log so that it's easier to test when debugging... } EventLog.WriteEntry(e.Exception.ToString(), EventLogEntryType.Error, 1); }
private void OnSourceFailed(object sender, ExceptionEventArgs e) { Source = null; // setting a local value seems scetchy... BitmapFailed(this, e); }
private void Session_ErrorOccured(object sender, ExceptionEventArgs e) { this._exception = e.Exception; this._sessionErrorOccuredWaitHandle.Set(); }
protected override void OnError(ExceptionEventArgs e) { Logger.Error(e.Exception, "Unhandled server exception"); base.OnError(e); }
private static void OutboundOnConnectionError(object sender, ExceptionEventArgs args) { Console.WriteLine($"[{DateTime.Now:s}] Error connecting to {sender}: {args.InnerException.Message}"); }
public override void OnException(ExceptionEventArgs e) { e.Connection.BeginDisconnect(); }
/// <summary> Sets up the eviroment and raises user events </summary> internal void RaisePausedEvents() { AssertPaused(); DisableAllSteppers(); CheckSelectedStackFrames(); SelectMostRecentStackFrameWithLoadedSymbols(); if (this.PauseSession.PausedReason == PausedReason.Exception) { ExceptionEventArgs args = new ExceptionEventArgs(this, this.SelectedThread.CurrentException, this.SelectedThread.CurrentExceptionType, this.SelectedThread.CurrentExceptionIsUnhandled); OnExceptionThrown(args); // The event could have resumed or killed the process if (this.IsRunning || this.TerminateCommandIssued || this.HasExited) return; } while(BreakpointHitEventQueue.Count > 0) { Breakpoint breakpoint = BreakpointHitEventQueue.Dequeue(); breakpoint.NotifyHit(); // The event could have resumed or killed the process if (this.IsRunning || this.TerminateCommandIssued || this.HasExited) return; } OnPaused(); // The event could have resumed the process if (this.IsRunning || this.TerminateCommandIssued || this.HasExited) return; }
private void Channel_Exception(object sender, ExceptionEventArgs e) { RaiseExceptionEvent(e.Exception); }
private void OnSourceFailed(object sender, ExceptionEventArgs e) { Source = null; BitmapFailed(this, e); }
private void OnSourceDownloadFailed(object sender, ExceptionEventArgs e) { RaiseDownloadFailed(e); }
private void OnExceptionReceived(ExceptionEventArgs e) { Exception?.Invoke(e); }
private void OnError(object sender, ExceptionEventArgs e) { Events.RaiseEvent(this, Error, e); DialogResult = false; this.Close(); }
private void MediaPlayer_MediaFailed(object sender, ExceptionEventArgs e) { FaultLoading(e.ErrorException); }
private void Sensor2_ErrorOccurred(object sender, ExceptionEventArgs e) => Sensor2ErrorOccurred?.Invoke(sender, e);
private void NameserverProcessor_ConnectingException(object sender, ExceptionEventArgs e) { //MessageBox.Show(e.Exception.ToString(), "Connecting exception"); Console.WriteLine("==>Connecting failed"); }
private void Session_ErrorOccured(object sender, ExceptionEventArgs e) { this.RaiseError(e.Exception); }
void image_DownloadFailed(object sender, ExceptionEventArgs e) { MessageBox.Show(e.ErrorException.Message, "Couldn't retrieve map"); }
private void Session_ErrorOccured(object sender, ExceptionEventArgs e) { // If objected is disposed or being disposed don't handle this event if (this._isDisposed) return; this._exception = e.Exception; this._sessionErrorOccuredWaitHandle.Set(); }
void debuggedProcess_ExceptionThrown(object sender, ExceptionEventArgs e) { JumpToCurrentLine(); StringBuilder stacktraceBuilder = new StringBuilder(); // Need to intercept now so that we can evaluate properties if (e.Process.SelectedThread.InterceptCurrentException()) { stacktraceBuilder.AppendLine(e.Exception.ToString()); string stackTrace; try { stackTrace = e.Exception.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.EndOfInnerException}")); } catch (GetValueException) { stackTrace = e.Process.SelectedThread.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}"), StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}")); } stacktraceBuilder.Append(stackTrace); } else { // For example, happens on stack overflow stacktraceBuilder.AppendLine(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Error.CannotInterceptException}")); stacktraceBuilder.AppendLine(e.Exception.ToString()); stacktraceBuilder.Append(e.Process.SelectedThread.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}"), StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}"))); } string title = e.IsUnhandled ? StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Title.Unhandled}") : StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Title.Handled}"); string message = string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Message}"), e.Exception.Type, e.Exception.Message); Bitmap icon = WinFormsResourceService.GetBitmap(e.IsUnhandled ? "Icons.32x32.Error" : "Icons.32x32.Warning"); DebuggeeExceptionForm.Show(debuggedProcess, title, message, stacktraceBuilder.ToString(), icon); }
private void Session_ErrorOccured(object sender, ExceptionEventArgs e) { RaiseError(e); }
private static void ApplicationException(object sender, ExceptionEventArgs e) { MessageDialog.ShowError("Unknown error. Please contact with the developer.\n" + e.ErrorException); }
static void NameserverProcessor_ConnectionException(object sender, ExceptionEventArgs e) { WL("NameserverProcessor_ConnectionException"); }
private void HandleException(object sender, ExceptionEventArgs e) { if (e.SuspendPolicy == SuspendPolicy.All) Interlocked.Increment(ref _suspended); JavaDebugThread thread; lock (_threads) { this._threads.TryGetValue(e.Thread.GetUniqueId(), out thread); } bool stop; bool firstChance = e.CatchLocation != null; EXCEPTION_INFO exceptionInfo; if (DebugEngine.TryGetException(e.Exception.GetReferenceType().GetName(), out exceptionInfo)) { if (firstChance && (exceptionInfo.dwState & enum_EXCEPTION_STATE.EXCEPTION_STOP_FIRST_CHANCE) != 0) stop = true; else if (!firstChance && (exceptionInfo.dwState & enum_EXCEPTION_STATE.EXCEPTION_STOP_SECOND_CHANCE) != 0) stop = true; else stop = !firstChance; } else { stop = !firstChance; } JavaDebugExceptionEvent exceptionEvent = new JavaDebugExceptionEvent(GetAttributesForEvent(e), this, e.Thread, e.Exception, e.Location, e.CatchLocation); if (stop) { SetEventProperties(exceptionEvent, e, false); Callback.Event(DebugEngine, Process, this, thread, exceptionEvent); } else { string message = exceptionEvent.GetDescription() + Environment.NewLine; DebugEvent debugEvent = new DebugOutputStringEvent(message); SetEventProperties(debugEvent, e, true); Callback.Event(DebugEngine, Process, this, thread, debugEvent); ManualContinueFromEvent(e); } }
static void server_ExceptionThrown(object sender, ExceptionEventArgs e) { throw new NotImplementedException(); }
protected internal virtual void OnExceptionThrown(ExceptionEventArgs e) { TraceMessage ("Debugger event: OnExceptionThrown()"); if (ExceptionThrown != null) { ExceptionThrown(this, e); } }
private void NameserverProcessor_ConnectingException(object sender, ExceptionEventArgs e) { }
protected virtual void OnError(object sender, ExceptionEventArgs e) { Error?.Invoke(sender, e); }
private void Nameserver_ExceptionOccurred(object sender, ExceptionEventArgs e) { }
private void Nameserver_AuthenticationError(object sender, ExceptionEventArgs e) { Console.WriteLine("==>Authentication failed:" + e.Exception.InnerException.Message); }
private void Nameserver_AuthenticationError(object sender, ExceptionEventArgs e) { }
void socketHandler_Exception(object sender, ExceptionEventArgs e) { if (e.Exception is SocketException && !socket.Connected) { if (autoLoginEnabled) { timerAction = TimerAction.ReConnect; timer.Start(); } fireConnectStateChange(ConnectionState.Disconnected, e.Exception.Message); } }
public static void Image_FailedLoading(object sender, ExceptionEventArgs e) { RPC.Log.ImageError(sender as BitmapImage, e); }
private void Session_ErrorOccured(object sender, ExceptionEventArgs e) { StopListener(); }
private void directConnection_ConnectingException(object sender, ExceptionEventArgs e) { OnBridgeClosed(EventArgs.Empty); }