internal static void Initialize()
        {
            AppTrace.Initialize(OnWarningException);

            try
            {
                Application.Current.Exit += (_, __) => _isAppShuttingDown = true;
#if DEBUG
                WPFClient.Config.ApiKey = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\eartrumpet.bugsnag.apikey");
#endif

                WPFClient.Config.StoreOfflineErrors = true;
                WPFClient.Config.AppVersion         = App.Current.GetVersion().ToString();
                WPFClient.Start();

                WPFClient.Config.BeforeNotify(OnBeforeNotify);

                Task.Factory.StartNew(WPFClient.SendStoredReports);
            }
            catch (Exception ex)
            {
                // No point in AppTrace.LogWarning here because bugsnag is broken.
                Trace.WriteLine(ex);
            }
        }