// Returns true if the message can be sent, false if the sending is canceled. protected bool OnSendingMessage(RaygunMessage raygunMessage) { bool result = true; if (!_handlingRecursiveErrorSending) { EventHandler <RaygunSendingMessageEventArgs> handler = SendingMessage; if (handler != null) { RaygunSendingMessageEventArgs args = new RaygunSendingMessageEventArgs(raygunMessage); try { handler(this, args); } catch (Exception e) { // Catch and send exceptions that occur in the SendingMessage event handler. // Set the _handlingRecursiveErrorSending flag to prevent infinite errors. _handlingRecursiveErrorSending = true; Send(e); _handlingRecursiveErrorSending = false; } result = !args.Cancel; } } return(result); }
private void RaygunClient_SendingMessage(object sender, RaygunSendingMessageEventArgs e) { if (e.Message != null && e.Message.Details != null && e.Message.Details.Error != null) { RaygunErrorStackTraceLineMessage[] stackTrace = e.Message.Details.Error.StackTrace; if (stackTrace != null && stackTrace.Length > 1) { string firstLine = stackTrace[0].Raw; if ( firstLine != null && ( // Older Xamarin versions (pre Xamarin.Android 6.1) firstLine.Contains("--- End of managed exception stack trace ---") || // More recent Xamarin versions firstLine.Contains("--- End of managed " + e.Message.Details.Error.ClassName + " stack trace ---") ) ) { foreach (RaygunErrorStackTraceLineMessage line in stackTrace.Skip(1)) { if (line.Raw != null && !line.Raw.StartsWith("at ") && line.Raw.Contains("JavaProxyThrowable")) { // Reaching this point means the exception is wrapping a managed exception that has already been sent. // Such exception does not contain any additional useful information, and so is a waste to send it. e.Cancel = true; break; } } } } } }
// Returns true if the message can be sent, false if the sending is canceled. protected bool OnSendingMessage(RaygunMessage raygunMessage) { bool result = true; if (!_handlingRecursiveErrorSending) { EventHandler<RaygunSendingMessageEventArgs> handler = SendingMessage; if (handler != null) { RaygunSendingMessageEventArgs args = new RaygunSendingMessageEventArgs(raygunMessage); try { handler(this, args); } catch (Exception e) { // Catch and send exceptions that occur in the SendingMessage event handler. // Set the _handlingRecursiveErrorSending flag to prevent infinite errors. _handlingRecursiveErrorSending = true; Send(e); _handlingRecursiveErrorSending = false; } result = !args.Cancel; } } return result; }
// Returns true if the message can be sent, false if the sending is canceled. protected bool OnSendingMessage(RaygunMessage raygunMessage) { bool result = true; EventHandler<RaygunSendingMessageEventArgs> handler = SendingMessage; if (handler != null) { RaygunSendingMessageEventArgs args = new RaygunSendingMessageEventArgs(raygunMessage); handler(this, args); result = !args.Cancel; } return result; }
// Returns true if the message can be sent, false if the sending is canceled. protected bool OnSendingMessage(RaygunMessage raygunMessage) { bool result = true; EventHandler <RaygunSendingMessageEventArgs> handler = SendingMessage; if (handler != null) { RaygunSendingMessageEventArgs args = new RaygunSendingMessageEventArgs(raygunMessage); handler(this, args); result = !args.Cancel; } return(result); }
private void RaygunClient_SendingMessage(object sender, RaygunSendingMessageEventArgs e) { if (e.Message != null && e.Message.Details != null && e.Message.Details.Error != null) { RaygunErrorStackTraceLineMessage[] stackTrace = e.Message.Details.Error.StackTrace; if (stackTrace != null && stackTrace.Length > 1) { if (stackTrace[0].FileName != null && stackTrace[0].FileName.Contains("--- End of managed exception stack trace ---")) { foreach (RaygunErrorStackTraceLineMessage line in stackTrace) { if (line.FileName != null && line.FileName.Contains("Caused by:") && line.FileName.Contains("JavaProxyThrowable")) { // Reaching this point means the exception is wrapping a managed exception that has already been sent. // Such exception does not contain any additional useful information, and so is a waste to send it. e.Cancel = true; break; } } } } } }