Identifying crashes at launch

If your app crashes whilst it is launching, you may want to give the crash more attention. Bugsnag provides an API to mark events that occur during startup and also allows you to detect recurrent launch crashes.

Controlling the launch period

By default, Bugsnag will treat crashes that occur during the first 5 seconds after starting Bugsnag as having occurred during launch. Events that occur during the app launch have their app.isLaunching property set to true.

To modify this launch time period, use the Launch Duration configuration option. You can also manually indicate that your app has finished launching:

UBugsnagFunctionLibrary::MarkLaunchCompleted();

To disable the automatic ending of the launch period, set the Launch Duration configuration option to 0 — in this case the app will be considered to be launching until MarkLaunchCompleted() is called.

Configuration->SetLaunchDurationMillis(0);
UBugsnagFunctionLibrary::Start(Configuration);

// Once your app has finished launching
UBugsnagFunctionLibrary::MarkLaunchCompleted();

You can also mark the end of the launch period from Blueprints using Bugsnag’s “Mark Launch Completed” action.

Sending launch crashes

If the previous run of your app crashed during app launch, Bugsnag will block the calling thread for up to 2 seconds when it starts to allow the crash report to be sent before the app continues launching. In cases where a launch crash is persistent, this improves the reliability of crash reporting.

This behavior can be disabled using the SendLaunchCrashesSynchronously configuration option.

Recovering after launch crashes

After a launch crash, it may be appropriate to take some actions in your app, such as removing cached data or resetting some persistent state, to make another one less likely to occur.

TSharedPtr<FBugsnagLastRunInfo> LastRunInfo = UBugsnagFunctionLibrary::GetLastRunInfo();
if (LastRunInfo.IsValid() && LastRunInfo->GetCrashedDuringLaunch())
{
    // Enable "safe mode"
}

The LastRunInfo object contains the following properties;

property type description
ConsecutiveLaunchCrashes Integer The number of consecutive runs that have ended with a crash while launching.
Crashed Boolean true if the previous run crashed.
CrashedDuringLaunch Boolean true if the previous run crashed while launching.