Skip to content

Hot restart problems on pause #2018

Closed
Closed
@annagrin

Description

@annagrin

Hot restart is not working properly if the flutter app is paused when the hot restart is initiated.

Repro steps:

  • Open flutter hello_world project in VSCode
  • Add a breakpoint on the line that calls runMain
  • Hot restart

Observe the breakpoint not hitting.

Notes
To perform the hot restart we need the app to be running, so we remove all the breakpoints, resume the app, then hot restart, and re-establish breakpoints after the main is reloaded. This seems to be too late for the breakpoints to hit.

Suggestion
Break hot restart into two steps - running the bootstrap and running main (flutter engine main in that case). Then re-establishing the breakpoints can be done in between the two.

Some issues we are encountering currently with this suggestion

<html>
  <head>
    <head>
        <title>Hello, World</title>
    </head>
    <script src="flutter.js" defer></script>
  </head>
  <body>
    <script>
        window.addEventListener('load', function (ev) {
          // Download main.dart.js
          _flutter.loader.loadEntrypoint({
            onEntrypointLoaded: async function(engineInitializer) {
              // Immediately run the app
              await engineInitializer.autoStart();
            }
          });
        });
      </script>
  </body>
</html>

I am hitting the following: flutter/flutter#121905. Currently blocked on this, will continue the investigation after it is fixed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions