From 143feb59f05965fb068abee2f84cbccb4f3630ae Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Fri, 24 Nov 2023 10:36:19 +0100 Subject: [PATCH 1/4] load_image_list_integration now appends debug_meta info to all non-transaction events with a stacktrace, instead of checking for Exception existence --- .../load_image_list_integration.dart | 18 +++++++++++++----- .../integrations/load_image_list_test.dart | 7 +------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/flutter/lib/src/integrations/load_image_list_integration.dart b/flutter/lib/src/integrations/load_image_list_integration.dart index c2a0c98848..43bb3d2c3d 100644 --- a/flutter/lib/src/integrations/load_image_list_integration.dart +++ b/flutter/lib/src/integrations/load_image_list_integration.dart @@ -25,14 +25,22 @@ extension _NeedsSymbolication on SentryEvent { if (this is SentryTransaction) { return false; } - if (exceptions?.isNotEmpty == false) { - return false; - } - final frames = exceptions?.first.stackTrace?.frames; + final frames = _getStacktraceFrames(); if (frames == null) { return false; } - return frames.any((frame) => 'native' == frame.platform); + return frames.any((frame) => 'native' == frame?.platform); + } + + List? _getStacktraceFrames() { + if (exceptions?.isNotEmpty == true) { + return exceptions?.first.stackTrace?.frames; + } + if (threads?.isNotEmpty == true) { + var stacktraces = threads?.map((e) => e.stacktrace); + return stacktraces?.where((element) => element != null).expand((element) => element!.frames).toList(); + } + return null; } } diff --git a/flutter/test/integrations/load_image_list_test.dart b/flutter/test/integrations/load_image_list_test.dart index bb78561dae..085bbcd3dc 100644 --- a/flutter/test/integrations/load_image_list_test.dart +++ b/flutter/test/integrations/load_image_list_test.dart @@ -187,12 +187,7 @@ void main() { SentryEvent _getEvent() { final frame = SentryStackFrame(platform: 'native'); final st = SentryStackTrace(frames: [frame]); - final ex = SentryException( - type: 'type', - value: 'value', - stackTrace: st, - ); - return SentryEvent(exceptions: [ex]); + return SentryEvent(threads: [SentryThread(stacktrace: st)]); } class Fixture { From 94fa6d45e1cfba4cc5f602fc5bd8f12a3a56ab53 Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Fri, 24 Nov 2023 10:44:10 +0100 Subject: [PATCH 2/4] updated changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a599a956..65258be089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Add debug_meta to all events ([#1756](https://github.com/getsentry/sentry-dart/pull/1756)) + ## 7.13.2 ### Fixes From e487572b5963f6d15ca13d7ee2ecdf198bd869bb Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Fri, 24 Nov 2023 11:25:18 +0100 Subject: [PATCH 3/4] formatted code --- .../lib/src/integrations/load_image_list_integration.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flutter/lib/src/integrations/load_image_list_integration.dart b/flutter/lib/src/integrations/load_image_list_integration.dart index 43bb3d2c3d..8838ae0e4b 100644 --- a/flutter/lib/src/integrations/load_image_list_integration.dart +++ b/flutter/lib/src/integrations/load_image_list_integration.dart @@ -38,7 +38,10 @@ extension _NeedsSymbolication on SentryEvent { } if (threads?.isNotEmpty == true) { var stacktraces = threads?.map((e) => e.stacktrace); - return stacktraces?.where((element) => element != null).expand((element) => element!.frames).toList(); + return stacktraces + ?.where((element) => element != null) + .expand((element) => element!.frames) + .toList(); } return null; } From 9fed134a1213cb67589a8b99a0bce279f246db4b Mon Sep 17 00:00:00 2001 From: stefanosiano Date: Wed, 29 Nov 2023 15:45:21 +0100 Subject: [PATCH 4/4] updated changelog with explanation of debug_meta usage --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83e7d8cd80..11a30dc056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ### Fixes - Add debug_meta to all events ([#1756](https://github.com/getsentry/sentry-dart/pull/1756)) + - Fixes obfuscated stacktraces when `captureMessage` or `captureEvent` is called with `attachStacktrace` option + ### Features - Add option to opt out of fatal level for automatically collected errors ([#1738](https://github.com/getsentry/sentry-dart/pull/1738))