Hot Restart does not complete if exceptions are hit during the restart
See original GitHub issueDescribe 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(),
);
}
}
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:
- Created 2 years ago
- Reactions:3
- Comments:12 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
I’ve opened #3631 to track the Flutter DAP fix, as it’s a bit stalled on the main DAP work landing.