How to instrument applications on Windows for crash reporting

In this section we will describe how to instrument application on Windows application to enable crash reporting on them for HockeyApp. HockeyApp currently supports Windows 10 UWP, Windows 8.1 WinRT, Silverlight 8.0 and 8.1, WPF applications.

This document contains the following sections:

  1. Setup
  2. Advanced Setup

    1. Crash Description API
    2. Collectors API
    3. User Info API
    4. Internal Logging API
    5. Custom Server URL API
  3. Known issues

1. Setup

  1. Please, follow the setup steps in HockeyApp for Applications on Windows.

2. Advanced setup

2.1 Crash description API

HockeyApp allows you to attach an arbitrary string to every individual crash by using SetExceptionDescriptionLoader API. You can use this feature to attach any custom logs to your crash. In the example below we are attaching Exception.HResult code as a log string to every exception.

    Microsoft.HockeyApp.HockeyClient.Current.Configure("Your_App_ID")
         .SetExceptionDescriptionLoader((Exception ex) =>
            {
                return "Exception HResult: " + ex.HResult.ToString();
            });

The logs will be shown in Crash Logs >> Description tab
uwp-description.png

2.2. Collectors API

HockeyApp allows you to control what kind of data you want to collect. This can be done by setting Collectorsproperty on TelemetryConfiguration object. Code snippet example is provided below.

    Microsoft.HockeyApp.HockeyClient.Current.Configure("Your_App_ID",
        new Microsoft.HockeyApp.TelemetryConfiguration()
        {
            Collectors = WindowsCollectors.Metadata | WindowsCollectors.Session | WindowsCollectors.UnhandledException
        });

WindowsCollectors enumeration has the following flags:

  • WindowsCollectors.Metadata - Specifies whether device and application information will be collected.

  • WindowsCollectors.Session - Specifies whether users and sessions information will be collected.

  • WindowsCollectors.UnhandledException - Specifies whether crash information will be collected.

By default Collectors property is set to WindowsCollectors.Metadata | WindowsCollectors.Session | WindowsCollectors.UnhandledException.

2.3. User Info API

You can use user info API, as provided below to associate a crash with user email to further contain a user to get more details about the crash.

`HockeyClient.Current.UpdateContactInfo("user_id","contact_info")`

Containt-Info.png

2.4. Internal Logging API

Provide a logger for HockeyApp internal logging
HockeyLogManager.GetLog = (t) => { return new LoggerThatImplementsILog(t); }

2.5. Custom Server URL API

Define the HockeyApp server url (for use with a dedicated instance of HockeyApp)
HockeyClient.Current.Configure(YourApp_ID).SetApiDomain("https://your.hockeyapp.server")

3. Known issues

  1. Crashes and custom events from BackgroundTask will not be reported.

  2. If you are developing a project in VS 2015 update 1 or lower, you may see that all stack frames to execute code inside SharedLibrary.dll, instead of the real assembly name. This is a known issue and is fixed with VS 2015 update 2. Please, use Thread # Crashed section to get assembly name instead of Exception Stack section in log tab. uwp-sharedlibrary-knownissue.png

  3. Crashes that happen during the first second of application lifetime, will not be reported.

  4. HockeySDK had a known issue with Visual Studio 2015 Update 3 if you are not running at least version 5.2.2 of Microsoft.NetCore.UniversalWindowsPlatform NuGet package. Please update to the latest of this package: https://www.nuget.org/packages/Microsoft.NETCore.UniversalWindowsPl...