Microsoft.HockeyApp.UnhandledExceptionTelemetryModule.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( ) : void
return void
        public void Initialize()
        {
            if (!initialized)
            {
                Application.Current.UnhandledException += async (sender, e) =>
                {
                    e.Handled = true;
                    await HockeyClient.Current.AsInternal().HandleExceptionAsync(e.Exception);
                    if (CustomUnhandledExceptionFunc == null || CustomUnhandledExceptionFunc(e))
                    {
                        Application.Current.Exit();
                    }
                };

                initialized = true;
            }
        }
    }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// main configuration method. call in app constructor
        /// </summary>
        /// <param name="this"></param>
        /// <param name="appId"></param>
        /// <param name="rootFrame"></param>
        /// <returns></returns>
        public static IHockeyClientConfigurable Configure(this IHockeyClient @this, string appId, TelemetryConfiguration telemetryConfiguration = null, Frame rootFrame = null)
        {
            @this.AsInternal().PlatformHelper = new HockeyPlatformHelperWP8SL();
            @this.AsInternal().AppIdentifier  = appId;
            CrashHandler.Current.Application = Application.Current;

            ServiceLocator.AddService <BaseStorageService>(new StorageService());
            ServiceLocator.AddService <Services.IApplicationService>(new ApplicationService());
            ServiceLocator.AddService <Services.IPlatformService>(new PlatformService());
            ServiceLocator.AddService <IDeviceService>(new DeviceService());
            var exceptionModule = new UnhandledExceptionTelemetryModule(rootFrame);

            // we need to initialize in Configure method and not in WindowsAppInitializer.InitializeAsync
            // to prevent UnauthorizedAccessException with Invalid cross-thread access message
            exceptionModule.Initialize();
            ServiceLocator.AddService <IUnhandledExceptionTelemetryModule>(exceptionModule);
            WindowsAppInitializer.InitializeAsync(appId, telemetryConfiguration);
            return(@this as IHockeyClientConfigurable);
        }
All Usage Examples Of Microsoft.HockeyApp.UnhandledExceptionTelemetryModule::Initialize