Skip to content

Commit

Permalink
Merge f1ee3aa into cdf9acd
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin authored Nov 24, 2022
2 parents cdf9acd + f1ee3aa commit a7c040f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This version adds a dependency on Swift.
### Features

- Properly demangle Swift class name (#2162)
- Marks App hang's event stacktrace snapshot as true (#2441)

### Fixes

Expand Down
4 changes: 4 additions & 0 deletions Sources/Sentry/SentryANRTrackingIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "SentryHub+Private.h"
#import "SentryMechanism.h"
#import "SentrySDK+Private.h"
#import "SentryStacktrace.h"
#import "SentryThread.h"
#import "SentryThreadInspector.h"
#import "SentryThreadWrapper.h"
Expand Down Expand Up @@ -65,8 +66,11 @@ - (void)anrDetected
SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentryLevelError];
SentryException *sentryException = [[SentryException alloc] initWithValue:message
type:@"App Hanging"];

sentryException.mechanism = [[SentryMechanism alloc] initWithType:@"AppHang"];
sentryException.stacktrace = [threads[0] stacktrace];
sentryException.stacktrace.snapshot = @(YES);

[threads enumerateObjectsUsingBlock:^(SentryThread *_Nonnull obj, NSUInteger idx,
BOOL *_Nonnull stop) { obj.current = [NSNumber numberWithBool:idx == 0]; }];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class SentryANRTrackingIntegrationTests: SentrySDKIntegrationTestsBase {
XCTAssertEqual(ex.value, "App hanging for at least 4500 ms.")
XCTAssertNotNil(ex.stacktrace)
XCTAssertEqual(ex.stacktrace?.frames.first?.function, "main")
XCTAssertTrue(ex.stacktrace?.snapshot?.boolValue ?? false)
XCTAssertTrue(event?.threads?[0].current?.boolValue ?? false)

guard let threads = event?.threads else {
Expand Down

0 comments on commit a7c040f

Please sign in to comment.