Skip to content

fix: Synchronize C# metadata changes with native layer #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2019

Conversation

kattrali
Copy link
Contributor

@kattrali kattrali commented Jun 27, 2019

Goal

When using Bugsnag.Metadata.Add(), any added metadata should be synchronized with the native layer to ensure the values are sent with native crash reports as well as Unity log reports.

Example usage:

void Start() {
    Bugsnag.Metadata.Add("app", new Dictionary<string, string>(){
      {"buildno", "0.1" },
      {"package", "C" }
    });
}

Changeset

  • Added a INativeClient ref to the Metadata initializer
  • Enhanced the Metadata class with custom Add() and Remove() implementations which propagate changes to the native layer
  • Switches the Report.Metadata class to Dictionary<string, object> instead of Metadata since it requires no synchronization

Requires bugsnag/bugsnag-android#505

Artifacts

Tests

Test handled and unhandled, native and C# crashes on each:

  • Test change on iOS
  • Test change on macOS
  • Test change on Android

@kattrali kattrali force-pushed the kattrali/metadata-native-sync branch 2 times, most recently from 0d42661 to c038380 Compare June 28, 2019 17:51
@kattrali kattrali marked this pull request as ready for review June 28, 2019 17:51
Copy link
Contributor

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments that will need resolution before releasing. It'd be good to understand why Report.MetaData was changed to a dictionary - as this appears to be a breaking change?

@kattrali kattrali force-pushed the kattrali/metadata-native-sync branch from c038380 to 65a6ecb Compare July 1, 2019 09:54
@kattrali
Copy link
Contributor Author

kattrali commented Jul 1, 2019

Made a few changes to make the fix less invasive. Metadata now has a non-native-syncing variant.

@kattrali kattrali force-pushed the kattrali/metadata-native-sync branch from 65a6ecb to e0ba550 Compare July 1, 2019 10:42
@kattrali kattrali merged commit 91319cb into master Jul 1, 2019
@kattrali kattrali deleted the kattrali/metadata-native-sync branch July 1, 2019 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants