Description
There might be a few edge cases for which the SentryANRTrackingIntegration captures app hang events for which is_foreground isn't true. The client sets this field here
|
#if SENTRY_HAS_UIKIT |
|
if (!isFatalEvent && eventIsNotReplay) { |
|
NSMutableDictionary *context = |
|
[event.context mutableCopy] ?: [NSMutableDictionary dictionary]; |
|
if (context[@"app"] == nil |
|
|| ([context[@"app"] isKindOfClass:NSDictionary.self] |
|
&& context[@"app"][@"in_foreground"] == nil)) { |
|
NSMutableDictionary *app = |
|
[(NSDictionary *)context[@"app"] mutableCopy] ?: [NSMutableDictionary dictionary]; |
|
context[@"app"] = app; |
|
|
|
UIApplicationState appState = |
|
[SentryDependencyContainer sharedInstance].application.applicationState; |
|
BOOL inForeground = appState == UIApplicationStateActive; |
|
app[@"in_foreground"] = @(inForeground); |
|
event.context = context; |
|
} |
|
} |
The SentryANRTrackingIntegration could already set this field, because the SDK only reports app hangs when the app is in the foreground to ensure this field is always set. A customer reported that they get some fatal app hang events for which this field isn't set.
We fixed an issue with #5681 that led to wrongly reported app hangs when the app came back from the background, which should minimize the occurrence of the above-mentioned edge cases.
Description
There might be a few edge cases for which the
SentryANRTrackingIntegrationcaptures app hang events for whichis_foregroundisn'ttrue. The client sets this field heresentry-cocoa/Sources/Sentry/SentryClient.m
Lines 760 to 777 in 1b9991e
The
SentryANRTrackingIntegrationcould already set this field, because the SDK only reports app hangs when the app is in the foreground to ensure this field is always set. A customer reported that they get some fatal app hang events for which this field isn't set.We fixed an issue with #5681 that led to wrongly reported app hangs when the app came back from the background, which should minimize the occurrence of the above-mentioned edge cases.