dart-lang / dart-lang/webdev

Breakpoints break in wrong location in unnamed extensions: FrameComputer: Error calculating sync frame: RangeError (end): Invalid value: Not in inclusive range 15..26: 10

Open
#2,574 0 comments 2 reactions 0 assignees View on GitHub
P3 package:dwds type-bug
Dominant language
Dart
Stars
224
Forks
94
Avg merge
7h 14m
Merged PRs (30d)
2

Description

This was originally raised at https://github.com/Dart-Code/Dart-Code/issues/5394 by @markbeij.

Breakpoints in unnamed extensions don't seem to work on web, instead execution pauses on the parent frame and an error is printed:

> FrameComputer: Error calculating sync frame: RangeError (end): Invalid value: Not in inclusive range 15..26: 10

The message appears to come from here:

https://github.com/dart-lang/webdev/blob/4a92ba588ab70f34d45bbeb3eeada3079fedf690/dwds/lib/src/debugging/frame_computer.dart#L73

Here I have a breakpoint on line 20 (`return this`) but execution paused at the parent frame:

![Image](https://github.com/user-attachments/assets/5b179dca-a3e6-4df2-a938-ee1a08ce1a9d)

Example code:

```dart
import 'package:flutter/material.dart';

void main() {
runApp(const MainApp());
}

class MainApp extends StatelessWidget {
const MainApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(body: Center(child: Text(''.myExtension()))),
);
}
}

extension on String {
String myExtension() {
return this; // Breakpoint on this line
}
}

```

Contributor guide

Open the contributing guide

Research direction

Start with dwds/lib/src/debugging/frame_computer.dart around the reported error and reproduce the issue using the provided unnamed-extension example in a web run. Set a breakpoint on `return this` and inspect the calculated frame and range handling. Done means execution pauses in the extension at the breakpoint without printing the RangeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.