Debbuger don't stop at line of code where the breakpoint is set

Viewed 1036

I have a problem that suddenly the Flutter web debugger doesn't stop at the breakpoints I set. For example, I have set a breakpoint in the main.dart at the initializeApp() line and the debugger is not stopping here instead it randomly opens stops at the main of the file 'web_entrypoint.dart' which is not created by myself.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  configureInjection(Environment.prod);
  await Firebase.initializeApp();

  final firebaseFirebaseRemoteConfigManager =
      FirebaseRemoteConfigManager(instance: remoteConfig);
  firebaseFirebaseRemoteConfigManager.setupDefaults();
  await remoteConfig.fetchAndActivate();

  runApp(MyApp());
}

When I set a breakpoint in a build method of any widget it also doesn't stop at the line of code it stops, for example in the 'scheduleFrame' method of the 'binding.dart' file.

I already have tried to check out earlier commits where the debugger 100% worked, but I still have the problem there, so I assume that it has to do something with my setup. Did anyone else had a similar problem?

Here is my flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 11.6 20G165 darwin-x64, locale de)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more
      details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.65.2)
3 Answers

The root cause of this issue is that version 100 of Google Chrome removed support for the "CallFrame.url" field in the debugger protocol. This caused the Dart/Flutter debuggers to stop working properly with respect to breakpoints and related debugging functionality.

The Dart/Flutter team has a fix in the "dwds" Dart component coming soon. This dwds component is incorporated into Dart's "webdev serve" and Flutter's "flutter run" web debuggers. See https://github.com/dart-lang/webdev/issues/1557 and https://github.com/dart-lang/webdev/pull/1559 for details.

A temporary workaround is to downgrade Chrome from v100 to v99 or earlier. But for this to work, you also have to disable all of Chrome's auto-update services, otherwise it will auto-update itself back to v100 and the issue will return.

I'm just having a similar (same?) problem on my new setup, the debugger stops in Chrome but not in my IDE (IntelliJ IDEA), on my previous machine it was working fine... The IDE stops in the base interceptor of Dio for any breakpoints! And stops at the correct line in the Sources tab of the Developer Tools in Chrome... Definitely seems to be a setup/config issue, but not sure what to change.

The flutter team has posted a temporary fix till the fix will be merged into stable: link

It worked for me and now I can debug web again.

Related