Exemple #1
0
 public void Register(IHub hub, SentryOptions options)
 {
     if (!Runtime.Current.IsMono())
     {
         options.AddEventProcessor(new NetFxInstallationsEventProcessor(options));
     }
 }
Exemple #2
0
        public void Register(IHub hub, SentryOptions options)
        {
            options.AddEventProcessor(new FormsEventProcessor(options));

            _nativeHandler = new NativeExceptionHandler();

#if !NETSTANDARD
            options.AddEventProcessor(new NativeEventProcessor(options));
#endif
            XamlLogger = new DelegateLogListener((arg1, arg2) =>
            {
                if (LogXamlErrors)
                {
                    SentrySdk.AddBreadcrumb(arg2, $"XamlLogger.{arg1}", level: BreadcrumbLevel.Warning);
                }
            });

            if (LogXamlErrors)
            {
                Log.Listeners.Add(XamlLogger);
            }

            //If initialized from the Android/IOS project, the current application is not going to be set in time, so wait a bit...
            Task.Run(async() =>
            {
                for (int i = 0; i < 5 && Application.Current is null; i++)
                {
                    await Task.Delay(1000);
                }
                if (Application.Current is null)
                {
                    options.DiagnosticLogger.Log(SentryLevel.Warning, "ContribSentry.Forms timeout for tracking Application.Current. Navigation tracking is going to be disabled");
                }
                else
                {
                    Application.Current.PageAppearing         += Current_PageAppearing;
                    Application.Current.PageDisappearing      += Current_PageDisappearing;
                    Application.Current.RequestedThemeChanged += Current_RequestedThemeChanged;
                }
            });
        }
        public void Register(IHub hub, SentryOptions options)
        {
            _hub = hub;

            options.AddEventProcessor(new UwpPlatformEventProcessor(options));
            options.DiagnosticLogger = new DebugDiagnosticLogger(options.DiagnosticLevel);

            _application = Application.Current;
            _application.UnhandledException += NativeHandle;
            _application.EnteredBackground  += OnSleep;
            _application.LeavingBackground  += OnResume;
        }
Exemple #4
0
        /// <summary>
        /// Adds ASP.NET classic integration.
        /// </summary>
        public static void AddAspNet(this SentryOptions options, RequestSize maxRequestBodySize = RequestSize.None)
        {
            var payloadExtractor = new RequestBodyExtractionDispatcher(
                new IRequestPayloadExtractor[] { new FormRequestPayloadExtractor(), new DefaultRequestPayloadExtractor() },
                options,
                () => maxRequestBodySize
                );

            var eventProcessor = new SystemWebRequestEventProcessor(payloadExtractor, options);

            options.AddEventProcessor(eventProcessor);
        }
Exemple #5
0
 public void Register(IHub hub, SentryOptions options)
 {
     try
     {
         if (!Runtime.Current.IsMono())
         {
             options.AddEventProcessor(new NetFxInstallationsEventProcessor(options));
         }
     }
     catch (Exception ex)
     {
         options.LogError("Failed to register NetFxInstallations.", ex);
     }
 }
Exemple #6
0
        /// <summary>
        /// Adds ASP.NET classic integration.
        /// </summary>
        public static void AddAspNet(this SentryOptions options, RequestSize maxRequestBodySize = RequestSize.None)
        {
            var payloadExtractor = new RequestBodyExtractionDispatcher(
                new IRequestPayloadExtractor[] { new FormRequestPayloadExtractor(), new DefaultRequestPayloadExtractor() },
                options,
                () => maxRequestBodySize);

            var eventProcessor = new SystemWebRequestEventProcessor(payloadExtractor, options);

            // Ignore options.IsGlobalModeEnable, we always want to use HttpContext as backing store here
            options.ScopeStackContainer ??= new HttpContextScopeStackContainer();

            options.DiagnosticLogger ??= new TraceDiagnosticLogger(options.DiagnosticLevel);
            options.Release ??= SystemWebVersionLocator.Resolve(options, HttpContext.Current);
            options.AddEventProcessor(eventProcessor);
            options.AddDiagnosticSourceIntegration();
        }