/// <summary> /// Cancels the localhost exceptions for Raygun message. /// </summary> /// <param name="e">The <see cref="RaygunSendingMessageEventArgs"/> instance containing the event data.</param> private static void CancelLocalhostExceptions(RaygunSendingMessageEventArgs e) { if (e.Message.Details.Request.HostName == "localhost") { e.Cancel = true; } }
/// <summary> /// Sets the application version to Raygun message. /// </summary> /// <param name="e">The <see cref="RaygunSendingMessageEventArgs"/> instance containing the event data.</param> private static void SetApplicationVersion(RaygunSendingMessageEventArgs e) { try { e.Message.Details.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); } catch (Exception) { // Failed to set application version } }
/// <summary> /// Handles the raygun client sending message. /// This will set any additional data to the message and ignore the local exceptions. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="RaygunSendingMessageEventArgs"/> instance containing the event data.</param> private static void RaygunClientOnSendingMessage(object sender, RaygunSendingMessageEventArgs e) { SetApplicationVersion(e); CancelLocalhostExceptions(e); }