/// <summary> /// Initialize the iOS specific code. /// </summary> /// <param name="hub">The hub.</param> /// <param name="options">The Sentry options.</param> public void Register(IHub hub, SentryOptions options) { _hub = hub; _observerTokens = new List <NSObject>(); _observerTokens.Add(NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidEnterBackgroundNotification, AppEnteredBackground)); _observerTokens.Add(NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.WillEnterForegroundNotification, AppEnteredForeground)); _observerTokens.Add(NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidReceiveMemoryWarningNotification, MemoryWarning)); options.AddExceptionProcessor(new NativeExceptionProcessor(_xamarinOptions)); RegisterInAppExclude(); }
/// <summary> /// Adds the entity framework integration. /// </summary> /// <param name="sentryOptions">The sentry options.</param> public static SentryOptions AddEntityFramework(this SentryOptions sentryOptions) { try { _ = SentryDatabaseLogging.UseBreadcrumbs(diagnosticLogger: sentryOptions.DiagnosticLogger); } catch (Exception e) { sentryOptions.DiagnosticLogger? .LogError("Failed to configure EF breadcrumbs. Make sure to init Sentry before EF.", e); } DbIntegration = new DbInterceptionIntegration(); sentryOptions.AddIntegration(DbIntegration); sentryOptions.AddExceptionProcessor(new DbEntityValidationExceptionProcessor()); // DbConcurrencyExceptionProcessor is untested due to problems with testing it, so it might not be production ready //sentryOptions.AddExceptionProcessor(new DbConcurrencyExceptionProcessor()); return(sentryOptions); }