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

[dwds/webdev] Latest -dev SDK constraint allows for 3.1.0 stable without new DDC debugger API #53459

Closed
parlough opened this issue Sep 7, 2023 · 10 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler

Comments

@parlough
Copy link
Member

parlough commented Sep 7, 2023

For some reason, changes that landed in 3.1.0-263.0-dev through 3.1.0-348.0-dev weren't part of Dart 3.1.0 stable. As a result, the new DDC runtime debugger API (which landed during this period) is not available for users of a stable SDK.

However, the SDK constraint of package:dwds and package:webdev of >=3.1.0-340.0.dev which is correct for -dev releases, also allows for a 3.1.0 stable SDK without the changes. So if you have a 3.1.X stable Dart version and run dart pub global activate webdev resolution will allow for package:webdev:3.0.7, but once debugging an app, you will get issues due to the incompatibilities.

Steps to reproduce:

  1. Use a stable Dart 3.1.0 SDK: 3.1.0 or 3.1.1 currently.
  2. Create a new project: dart create -t web my_app
  3. Debug it with webdev with your preferred mechanism: webdev serve --debug
  4. Add a breakpoint and debug main() and try to evaluate something to get an error.
An example resulting error when trying to evaluate main
[WARNING] Library org-dartlang-app:///web/main.dart is not loaded. This can happen for unreferenced libraries.
[WARNING] Failed to evaluate expression 'main'. 
[INFO] Unexpected error from chrome devtools:
text: Uncaught
exception:
  preview: null
  description: TypeError: dart.getFunctionMetadata is not a function
    at Function.<anonymous> (<anonymous>:4:21)
  type: object
  value: null
attempted JS eval: `      function() {
        const sdk = require('dart_sdk');
        const dart = sdk.dart;
        return dart.getFunctionMetadata(this);
      }
    `
stack trace:
()  3:20
:#0      handleErrorIfPresent (package:dwds/src/utilities/server.dart:91:5)
dart-lang/webdev#1      FunctionMetaData.metaDataFor (package:dwds/src/debugging/metadata/function.dart:36:5)
<asynchronous suspension>
dart-lang/webdev#2      StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:127:15)
<asynchronous suspension>

Related discussion: #53298 (comment)

@parlough
Copy link
Member Author

parlough commented Sep 7, 2023

Note that isn't an issue with these packages themselves, more of something confusing happening with the 3.1.0 dev releases. However, since 3.1.0 stable is already out, it seems it has to be fixed in webdev, with a new release with the updated constraint and either a retraction of 3.0.7 or a hotfix 3.0.7 release with a lowered dwds version.

@parlough parlough changed the title Latest 3.1.0-dev SDK constraint allows for 3.1.0 stable without new DDC debugger API Latest -dev SDK constraint allows for 3.1.0 stable without new DDC debugger API Sep 7, 2023
@annagrin
Copy link
Contributor

annagrin commented Sep 7, 2023

Thanks @parlough for reporting this, and for the workaround fixing it in webdev.

Looks like an issue with the SDK 3.1.0 release? Transferring to the sdk repo. Please advise how to handle out-of-order releases in the future.

@annagrin annagrin transferred this issue from dart-lang/webdev Sep 7, 2023
@parlough parlough changed the title Latest -dev SDK constraint allows for 3.1.0 stable without new DDC debugger API [dwds/webdev] Latest -dev SDK constraint allows for 3.1.0 stable without new DDC debugger API Sep 7, 2023
@annagrin
Copy link
Contributor

annagrin commented Sep 7, 2023

/cc @sigmundch

@elliette
Copy link
Contributor

elliette commented Sep 7, 2023

Just discussed this with @annagrin, after dart-lang/webdev#2207 has landed we will need to:

  • Release Webdev with the new constraints
  • Release DWDS with the new constraints (not strictly necessary, we verified that Flutter main which is using DWDS with the bad version constraint is already on Dart 3.2.0, however doing so is still a good idea)
  • Release a hotfix of Webdev with DWDS pinned to 19.0.2. This means we don't need to retract 3.0.7, but instead can tell users to run dart pub global activate to get the latest version Webdev

@parlough
Copy link
Member Author

parlough commented Sep 7, 2023

Sounds like a plan. Thanks for following up!

auto-submit bot pushed a commit to dart-lang/webdev that referenced this issue Sep 7, 2023
Update SDK constraints for most packages to the first `dev` release of 3.2.0 since the stable 3.1.0 release doesn't actually include the DDC debugger runtime API changes, but will allow for package resolution with the `3.1.0-...-dev` constraint and a 3.1.0 SDK. This will prevent that.

Others are updated to stable releases.

Issue reference: dart-lang/sdk#53459
@devoncarew devoncarew added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Sep 7, 2023
@elliette
Copy link
Contributor

elliette commented Sep 8, 2023

The hotfix release of Webdev has been published: https://pub.dev/packages/webdev/versions/3.0.7+1 Running dart pub global activate webdev should fetch this latest version.

@parlough
Copy link
Member Author

parlough commented Oct 12, 2023

I'm going to close this issue since this specific instance of the issue was fixed. Thanks all!

If you are experiencing similar issues, make sure you are using package:webdev version 3.0.7+1 or later (dart pub global active webdev to update).

Related follow-up work/issues are being tracked separately:

@mnordine
Copy link
Contributor

mnordine commented Nov 9, 2023

@parlough Just got this with Dart 3.1.5 SDK:

$ dart pub global activate webdev
00:07
Package webdev is currently active at version 3.0.7+1.
Resolving dependencies...
> build_daemon 4.0.1 (was 4.0.0)
  dds 2.11.1 (3.1.0 available)
  dds_service_extensions 1.6.0 (1.6.2 available)
  devtools_shared 4.0.1 (6.0.1 available)
  dwds 19.0.2+1 (22.1.0 available)
  file 6.1.4 (7.0.0 available)
  http 0.13.6 (1.1.0 available)
  uuid 3.0.7 (4.2.1 available)
  vm_service 11.10.0 (13.0.0 available)
  webdev 3.0.7+1 (3.2.0 available)
Building package executables...
Built webdev:webdev.
Installed executable webdev.
Activated webdev 3.0.7+1.
$ webdev build
00:30
[INFO] Reading cached asset graph completed, took 568ms
[INFO] Checking for updates since last build completed, took 1.4s
[INFO] Unhandled exception:
Instance of 'MissingPortFile'
#0      _existingPort (package:build_daemon/client.dart:24:37)
<asynchronous suspension>
#1      BuildDaemonClient.connect (package:build_daemon/client.dart:180:9)
<asynchronous suspension>
#2      BuildCommand.run (package:webdev/src/command/build_command.dart:66:20)
<asynchronous suspension>
#3      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#4      _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:12)
<asynchronous suspension>
#5      run (package:webdev/src/webdev_command_runner.dart:19:46)
<asynchronous suspension>

@elliette
Copy link
Contributor

elliette commented Nov 9, 2023

Hi @mnordine - could you open a separate bug for your issue? Please also include your Dart version. Thank you!

@mnordine
Copy link
Contributor

mnordine commented Nov 9, 2023

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler
Projects
None yet
Development

No branches or pull requests

6 participants