Skip to content
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

Exception withContext is overwritten by native scope sync #1658

Closed
krystofwoldrich opened this issue Sep 27, 2023 · 2 comments
Closed

Exception withContext is overwritten by native scope sync #1658

krystofwoldrich opened this issue Sep 27, 2023 · 2 comments

Comments

@krystofwoldrich
Copy link
Member

krystofwoldrich commented Sep 27, 2023

Description

Expected:

This code should capture the exception with extra breadcrumb.

    await Sentry.captureException(error, stackTrace: stackTrace, withScope: (scope) {
      scope.addBreadcrumb(Breadcrumb(message: 'breadcrumb from with scope'));
    });

Actual:

The breadcrumb is missing.

Culprit:

final breadcrumbsList = infos['breadcrumbs'] as List?;
if (breadcrumbsList != null &&
breadcrumbsList.isNotEmpty &&
_options.enableScopeSync) {
final breadcrumbsJson =
List<Map<dynamic, dynamic>>.from(breadcrumbsList);
final breadcrumbs = <Breadcrumb>[];
for (final breadcrumbJson in breadcrumbsJson) {
final breadcrumb = Breadcrumb.fromJson(
Map<String, dynamic>.from(breadcrumbJson),
);
breadcrumbs.add(breadcrumb);
}
event = event.copyWith(breadcrumbs: breadcrumbs);
}

Notes:
The local exception scope is overridden by the one we fetch from the native SDKs. Scope fetched from a native SDK contains both Flutter and Native data. We shouldn't introduce duplicates.

@krystofwoldrich
Copy link
Member Author

Related issue in RN getsentry/sentry-react-native#2146

@stefanosiano stefanosiano moved this from Needs Discussion to Backlog in Mobile SDKs Sep 28, 2023
@kahest kahest added the bug label Sep 28, 2023
@buenaflor buenaflor assigned buenaflor and unassigned buenaflor Oct 23, 2023
@kahest
Copy link
Member

kahest commented Mar 10, 2025

@buenaflor @krystofwoldrich closing this because it's outdated and low impact. Please reopen and provide addtl context if it's still relevant

@kahest kahest closed this as not planned Won't fix, can't repro, duplicate, stale Mar 10, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Mobile SDKs Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants