dart-lang / dart-lang/webdev

Expression eval fails with "Error: Module dart_sdk not loaded in the browser."

Closed
#2,869 3 comments 0 reactions 0 assignees View on GitHub
P1 package:webdev type-bug
Dominant language
Dart
Stars
224
Forks
94
Avg merge
4d 3h
Merged PRs (30d)
2

Description

When debugging (non-Flutter) web apps in VS Code, expression eval fails on some expressions with "Module dart_sdk not loaded in the browser".

Image

I think this only started recently, as Dart-Code integration tests start failing which (as far as I can tell) were passing previously.

I'm not sure whether the issue is in webdev, dwds, or the SDK. Although I don't seem to be able to repro in Flutter web apps.

```
==> {
"id": "20",
"jsonrpc": "2.0",
"method": "evaluateInFrame",
"params": {
"disableBreakpoints": true,
"expression": "DateTime.now().year",
"frameIndex": 0,
"isolateId": "193"
}
}
<== {
"jsonrpc": "2.0",
"result": {
"type": "@Instance",
"id": "#StringInstanceRef#Error: Module dart_sdk not loaded in the browser.",
"kind": "String",
"identityHashCode": 154905552,
"class": {
"type": "@Class",
"id": "classes|dart:core|String",
"name": "String",
"library": {
"type": "@Library",
"id": "dart:core",
"name": "dart:core",
"uri": "dart:core"
}
},
"valueAsString": "Error: Module dart_sdk not loaded in the browser.",
"length": 49
},
"id": "20"
}
```

To repro, I:

- created a new project using the basic web template from `dart create` (and VS Code's **Dart: Create New Project** command)
- created a `.vscode/launch.json` setting `program` to `web/` for the web debugger
{
"name": "dart_web_application_1",
"request": "launch",
"type": "dart",
"program": "web/"
}
- added a breakpoint into the `main` function in `main.dart`
- launched with `F5`
- when the app loaded, hit the Restart icon (since due to a race, breakpoints in startup code don't currently work for non-Flutter web debugging)
- when the debugger paused, tried to evaluate `DateTime.now().year` in the Debug Console

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the basic web template, web/ launch configuration, and the `DateTime.now().year` expression described in the issue. Start by tracing expression evaluation across the web debugger components, then verify that the expression evaluates successfully and that the affected Dart-Code integration tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
devtools, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.