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

"Stop on uncaught exceptions" sometimes stops on caught exceptions #55664

Closed
lukehutch opened this issue May 7, 2024 · 4 comments
Closed

"Stop on uncaught exceptions" sometimes stops on caught exceptions #55664

lukehutch opened this issue May 7, 2024 · 4 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.

Comments

@lukehutch
Copy link

lukehutch commented May 7, 2024

If I have "[Stop on] Uncaught exceptions" checked in VS Code, sometimes the debugger will stop when an exception is obviously caught, if there is an async gap between the try-catch and where the exception is thrown:

Example: await client.openStreamingConnection is clearly within a try-catch block, yet the runtime reports that the exception is unhandled, and the debugger stops on the exception as uncaught.

image

Workspace Environment
Dart Code extension: 3.89.20240501
Flutter extension: 3.89.20240501 (activated)

App: Visual Studio Code
App Host: desktop
Version: linux 1.89.0

Workspace type: Dart, Flutter (LSP) (Multiroot)

Dart (3.5.0-131.0.dev): /opt/flutter/bin/cache/dart-sdk
Flutter (3.22.0-23.0.pre.43): /opt/flutter (Pixel 7 Pro (android-arm64/android))

Output from 'dart info'

/opt/flutter/bin/cache/dart-sdk/bin/dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

Project info

  • sdk constraint: '>=3.1.5'
  • dependencies: auto_size_text, boxy, bubble, cached_network_image, carousel_slider, chat_message_timestamp, collection, cronet_http, cross_file, cupertino_http, cupertino_icons, dart_emoji, delayed_display, device_info_plus, dio, dio_smart_retry, email_validator, exif, extended_image, file_picker, flutter, flutter_cache_manager, flutter_email_sender, flutter_google_maps_webservices, flutter_image_utilities, flutter_localizations, flutter_persistent_value_notifier, flutter_staggered_grid_view, flutter_svg, flutter_value_notifier_stateful_widget, fluttericon, fluttertoast, geocoding, geolocator, google_fonts, google_maps_flutter, google_maps_webapi, google_places_flutter, http, image_crop, image_picker, image_picker_android, image_picker_platform_interface, intl, jiffy, keep_keyboard_popup_menu, latlong2, line_awesome_flutter, logging, maps_launcher, material_dialogs, package_info_plus, path_provider, persistent_bottom_nav_bar_v2, pexels_api, pinch_to_zoom_scrollable, provider, serverpod_auth_apple_flutter, serverpod_auth_client, serverpod_auth_facebook_flutter, serverpod_auth_google_flutter, serverpod_auth_shared_flutter, serverpod_client, serverpod_flutter, serverpod_serialization, share_plus, shared_preferences, syncfusion_flutter_datepicker, timezone, url_launcher
  • dev_dependencies: flutter_launcher_icons, flutter_lints, flutter_test, lints
  • elided dependencies: 1

Process info

Memory CPU Elapsed time Command line
69 MB 0.0% 14:30 dart devtools --machine --allow-embedding --dtd-uri ws:/9EChvxoYXkiWK34D
70 MB 0.0% 14:32 dart devtools --machine --allow-embedding --dtd-uri ws:/pquPWF3bHj8KzNfj
1392 MB 4.7% 14:33 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.89.20240501
1084 MB 2.2% 14:31 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.89.20240501
75 MB 0.0% 14:33 dart tooling-daemon --machine
76 MB 0.0% 14:31 dart tooling-daemon --machine
81 MB 0.2% 14:33 flutter_tools.snapshot daemon
82 MB 0.2% 14:31 flutter_tools.snapshot daemon
77 MB 0.2% 08:33 flutter_tools.snapshot debug_adapter
341 MB 0.8% 08:32 flutter_tools.snapshot run --machine --start-paused -d 29161FDH300BLP --devtools-server-address http:/ --target /main.dart
Output from 'flutter doctor'

/opt/flutter/bin/flutter doctor -v

[✓] Flutter (Channel master, 3.22.0-23.0.pre.43, on Fedora Linux 39 (Workstation Edition) 6.8.8-200.fc39.x86_64, locale en_US.utf8)
    • Flutter version 3.22.0-23.0.pre.43 on channel master at /opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8abc10689 (2 days ago), 2024-05-05 13:01:23 -0400
    • Engine revision 624dcb987f
    • Dart version 3.5.0 (build 3.5.0-131.0.dev)
    • DevTools version 2.35.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/luke/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /opt/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 17.0.6 (Fedora 17.0.6-2.fc39)
    • cmake version 3.27.7
    • ninja version 1.11.1
    • pkg-config version 1.9.5

[!] Android Studio (version unknown)
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.89.20240501

[✓] VS Code (version 1.90.0-insider)
    • VS Code at /usr/share/code-insiders
    • Flutter extension version 3.79.20231130

[✓] Connected device (3 available)
    • Pixel 7 Pro (mobile) • 29161FDH300BLP • android-arm64  • Android 14 (API 34)
    • Linux (desktop)      • linux          • linux-x64      • Fedora Linux 39 (Workstation Edition) 6.8.8-200.fc39.x86_64
    • Chrome (web)         • chrome         • web-javascript • Google Chrome 124.0.6367.118

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
@lukehutch lukehutch reopened this May 7, 2024
@lukehutch
Copy link
Author

There is also a rethrow involved, which may cause the problem:

image

@mraleph
Copy link
Member

mraleph commented May 11, 2024

We would need a reproduction of the behavior you are seeing or at least more code pasted as text with clear description of what is happening. (e.g. here is the code in each frame on the stack, here is where exception is thrown, here is where debugger has stopped, etc).

@mraleph mraleph added area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. needs-info We need additional information from the issue author (auto-closed after 14 days if no response) labels May 11, 2024
@mraleph
Copy link
Member

mraleph commented May 11, 2024

FWIW I can also see that exception is reported to the console as unhandled. So if that's the same exception the debugger stops for then debugger is correct.

@github-actions github-actions bot removed the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label May 12, 2024
@lukehutch
Copy link
Author

I spent considerable time trying to debug this, but couldn't follow the logic in this callback-based code. There are all sorts of weird (primitive Dart) conventions like capturing a stacktrace anywhere you think you may asynchronously throw an error in future, and then passing it into the async call...

I'll close this since I couldn't figure it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

2 participants