/// <summary>
        /// Reads configuration settings, configures various plugins and wires up to platform specific exception handlers.
        /// </summary>
        /// <param name="client">The ExceptionlessClient.</param>
        /// <param name="apiKey">The API key that will be used when sending events to the server.</param>
        public static void Startup(this ExceptionlessClient client, string apiKey = null)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            if (!String.IsNullOrEmpty(apiKey))
            {
                client.Configuration.ApiKey = apiKey;
            }

            client.Configuration.ReadAllConfig();
            client.Configuration.UseTraceLogEntriesPlugin();

            if (client.Configuration.UpdateSettingsWhenIdleInterval == null)
            {
                client.Configuration.UpdateSettingsWhenIdleInterval = TimeSpan.FromMinutes(2);
            }

            client.RegisterAppDomainUnhandledExceptionHandler();

            // make sure that queued events are sent when the app exits
            client.RegisterOnProcessExitHandler();
            client.RegisterTaskSchedulerUnobservedTaskExceptionHandler();

            if (client.Configuration.SessionsEnabled)
            {
                client.SubmitSessionStart();
            }
        }
Example #2
0
        /// <summary>
        /// Reads configuration settings, configures various plugins and wires up to platform specific exception handlers.
        /// </summary>
        /// <param name="client">The ExceptionlessClient.</param>
        public static void Register(this ExceptionlessClient client)
        {
            client.Startup();
            client.SubmitSessionStart();

            // make sure that queued events are sent when the app exits
            client.RegisterOnProcessExitHandler();
        }
Example #3
0
        /// <summary>
        /// Reads configuration settings, configures various plugins and wires up to platform specific exception handlers.
        /// </summary>
        /// <param name="client">The ExceptionlessClient.</param>
        /// <param name="showDialog">Controls whether a dialog is shown when an unhandled exception occurs.</param>
        public static void Register(this ExceptionlessClient client, bool showDialog = true)
        {
            client.Configuration.AddPlugin <SetEnvironmentUserPlugin>();
            client.Startup();

            if (client.Configuration.SessionsEnabled)
            {
                client.SubmitSessionStart();
            }

            client.RegisterApplicationThreadExceptionHandler();

            // make sure that queued events are sent when the app exits
            client.RegisterOnProcessExitHandler();

            if (!showDialog)
            {
                return;
            }

            client.SubmittingEvent -= OnSubmittingEvent;
            client.SubmittingEvent += OnSubmittingEvent;
        }