[PLAT-5503] Fix app version reported for crashes before v6.2.3 #911
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Fixes an issue whereby crash reports written by earlier releases of Bugsnag (prior to v6.2.3) would be sent to the dashboard with invalid app version information in the payload.
Design
The root cause was that
-[BugsnagEvent initWithKSCrashData:]
was passing the current configuration to-[BugsnagAppWithState appWithDictionary:config:codeBundleId:]
, and the app version information therein was being used in preference to the information written by KSCrash (e.g.system[@"CFBundleVersion"]
) whenuser.config
did not contain any values (which was the case until v6.2.3 / #862.)Changeset
-[BugsnagEvent initWithKSCrashData:]
now creates aBugsnagConfiguration
object initialized with the metadata config JSON written byBugsnagConfiguration
in the crashing session.-[BugsnagApp populateFields:]
has been simplified - now that config corresponds to the config for the crashing vesion we no longer need to examine the values inuser.config
.Testing
Manually verified by creating a crash report with Bugsnag 6.2.1 and then switching to this branch before building and running the app to send a report.
Some unit tests needed adjusting.
There are E2E test that validate that payloads contain the app versions specified in BugsnagConfiguration: