You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Breakpoints in Dart SDK files fail to bind (greyed out) during debugging #9150
Setting a breakpoint inside a Dart SDK file (for example, iterable.dart in dart:core) while debugging a Flutter application fails and the breakpoint icon becomes greyed out.
Root Cause
In VmServiceWrapper.addBreakpoint, getResolvedUri(position) converts the local file to a file:/// URI (e.g. file:///.../flutter/bin/cache/dart-sdk/lib/core/iterable.dart) and passes it to myVmService.lookupPackageUris.
In Flutter, the Dart SDK platform kernel (platform_strong.dill) is compiled using org-dartlang-sdk:///... URIs rather than the host machine's file:///.../flutter/bin/cache/dart-sdk/... path, and the Dart SDK is not listed in .dart_tool/package_config.json.
Consequently, lookupPackageUris returns [null] for file:/// paths inside the Dart SDK, causing VmServiceWrapper.addBreakpoint to report "Breakpoint could not be mapped to package URI" and mark the breakpoint as failed.
Potential Fix
Before (or when) calling getResolvedUri(position) / lookupPackageUris, check if DartUrlResolver.getDartUrlForFile(position.getFile()) resolves the file to a dart: URI (e.g. dart:core/iterable.dart), or fall back to myDebugProcess.getUrisForFile(position.getFile()) when lookupPackageUris returns null.
@DanTup does this work in VS Code? I'm not able to get a breakpoint in Dart SDK code there either, and I'm not sure if this is intended to work or not.
It looks like for Dart we'd expect the URIs to start org-dartlang-sdk:///sdk and for Flutter they would be org-dartlang-sdk:///flutter/third_party/dart/sdk.
I don't know if all the assumptions in those mappings are still valid (or whether there are additional URIs we're not handling). If it's not working right in VS Code, that sounds like a bug (likely in DAP) that we should fix. Hopefully it would just be a simple change/fix to these mappings.
I Ctrl+Clicked on contains() and added a breakpoint:
Which was correctly hit:
I did the same thing in a Flutter app and it also worked (although both the navigation and the break location are now in pkg/sky_engine):
So, as far as I can tell, things are working correctly in VS Code. However, I will note that it's easy to hit a situation where this appears to not work. For example given the code:
print([].contains(''));
If you Ctrl+Click here on contains, you end up in mixin class Iterable<E> and adding a breakpoint there appears not to work, but that's because at runtime this code goes into mixin class ListBase<E>'s implementation of contains(). I suspect this because the type of [] is List<E> which is an abstract class and the analyzer doesn't know which implementation the runtime is constructing and therefore can't take us to the implementation that would actually be used at runtime.
I don't know if the case you tested was something like this though. If you think there's a case where it doesn't work that isn't this, please file a Dart-Code issue and I'll take a look (to avoid taking this one off-track). If this does solve your issue and therefore it works in VS Code, then you might need to reproduce the mapping linked above (and hopefully in the future we could migrate to DAP and have only one implementation).
Ah okay! I was able to get your example to work in VS Code. And I think I was experiencing the exact problem you noted when I originally set up an example.
However, the same thing does not work in IntelliJ, so this is a real bug.
Activity
helin24 commentedon Oct 8, 2026
@DanTup does this work in VS Code? I'm not able to get a breakpoint in Dart SDK code there either, and I'm not sure if this is intended to work or not.
DanTup commentedon Oct 8, 2026
Yeah, that should work. It requires some additional mapping outside of what the VM is doing though.
See this mapping in the Dart/base adapter:
https://github.com/dart-lang/sdk/blob/e4dec8c8967cd7e85fcce91341778fb3305a9afa/pkg/dap_adapters/lib/src/adapters/dart.dart#L352
And this mapping in the Flutter adapter:
https://github.com/flutter/flutter/blob/9b5759043457c99e316507474dea424e15cfb0c0/packages/flutter_tools/lib/src/debug_adapters/flutter_base_adapter.dart#L120
It looks like for Dart we'd expect the URIs to start
org-dartlang-sdk:///sdkand for Flutter they would beorg-dartlang-sdk:///flutter/third_party/dart/sdk.I don't know if all the assumptions in those mappings are still valid (or whether there are additional URIs we're not handling). If it's not working right in VS Code, that sounds like a bug (likely in DAP) that we should fix. Hopefully it would just be a simple change/fix to these mappings.
DanTup commentedon Oct 9, 2026
@helin24 I did some testing in VS Code. In a Dart project, using:
I Ctrl+Clicked on
contains()and added a breakpoint:Which was correctly hit:
I did the same thing in a Flutter app and it also worked (although both the navigation and the break location are now in
pkg/sky_engine):So, as far as I can tell, things are working correctly in VS Code. However, I will note that it's easy to hit a situation where this appears to not work. For example given the code:
If you Ctrl+Click here on
contains, you end up inmixin class Iterable<E>and adding a breakpoint there appears not to work, but that's because at runtime this code goes intomixin class ListBase<E>'s implementation ofcontains(). I suspect this because the type of[]isList<E>which is an abstract class and the analyzer doesn't know which implementation the runtime is constructing and therefore can't take us to the implementation that would actually be used at runtime.I don't know if the case you tested was something like this though. If you think there's a case where it doesn't work that isn't this, please file a Dart-Code issue and I'll take a look (to avoid taking this one off-track). If this does solve your issue and therefore it works in VS Code, then you might need to reproduce the mapping linked above (and hopefully in the future we could migrate to DAP and have only one implementation).
Remove analysis server usages from debug (#9149)
helin24 commentedon Oct 9, 2026
Ah okay! I was able to get your example to work in VS Code. And I think I was experiencing the exact problem you noted when I originally set up an example.
However, the same thing does not work in IntelliJ, so this is a real bug.