question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hot Restart does not complete if exceptions are hit during the restart

See original GitHub issue

Describe the bug

First, check the All Exceptions and Uncaught Exceptions setting at debug panel.

Then debug the following example code. When debugger stoped at exception in function a, press continue button, the debugger will stoped at catch block in function b. Finally, click restart button, debugger will run into endless waiting.

import 'package:flutter/material.dart';

void a() {
  throw Exception('a');
}

void b() {
  try {
    a();
  } catch (e) {
    throw Exception('b');
  }
}

void c() {
  try {
    b();
  } catch (e) {
    throw Exception('c');
  }
}

void main() {
  runApp(App());
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    c();
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Study Flutter',
      theme: ThemeData(
        primarySwatch: Colors.green,
      ),
      home: Container(),
    );
  }
}

image

Expected behavior

After I click the restart button, debugger should stopped at exception in function a

Versions (please complete the following information):

  • VS Code version: 1.58.0-insider
  • Dart extension version: 2.2.0
  • Dart/Flutter SDK version: 3.23.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Nov 10, 2021

It turned out this doesn’t need any cooperation from the IDEs to fix in Flutter. The flag is per-isolate and and the restart creates new isolates, so it’s safe to just remove the flag on the existing isolates before the resume (same pace as breakpoints are removed) and the IDE already needs to set this flag on new isolates that are created.

I’ve opened a PR to move the fix to Flutter in https://github.com/flutter/flutter/pull/93411 since we needed it Flutter-side for the Flutter SDK DAP anyway.

0reactions
DanTupcommented, Oct 26, 2021

I’ve opened #3631 to track the Flutter DAP fix, as it’s a bit stalled on the main DAP work landing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hot reload - Flutter documentation
Even when a hot reload operation appears successful and generates no exceptions, some code changes might not be visible in the refreshed UI....
Read more >
Restarting a program after exception - python - Stack Overflow
Essentially, I want to call queryRepeatedly() upon an exception in one of its sub-functions, without keeping the previous call on the stack. Of...
Read more >
Update on .NET Hot Reload progress and Visual Studio 2022 ...
Updating progress and all the wonderful features towards .NET Hot Reload and Visual Studio 2022 Highlights.
Read more >
How to Fix the System Service Exception Stop Code in ...
1. Update Windows 10 · Hit Windows key + I to open the Settings panel. · Now, head to Update & Security, then...
Read more >
A Simple Guide to the FMCSA's 34-hour Restart Rule - Samsara
But to understand the full impact of the 34-hour reset, a quick refresher on truck drivers' HOS statuses is helpful. The four Hours...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found