Skip to content

Commit

Permalink
Disable pause-on-exception during hot restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTup committed Oct 25, 2021
1 parent 0cae3f7 commit 44c44e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/debug/flutter_debug_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ export class FlutterDebugSession extends DartDebugSession {

this.isReloadInProgress = true;
const restartType = hotRestart ? "hot-restart" : "hot-reload";

// To avoid issues with hot restart pausing on exceptions during the restart, we remove
// exception-pause behaviour here, and it will be re-added as part of the startup code
// when the new isolate appears.
if (hotRestart)
await this.threadManager.setExceptionPauseMode("None", false);

try {
await this.runDaemon.restart(this.currentRunningAppId, !this.noDebug, hotRestart, args);
} catch (e) {
Expand Down
6 changes: 4 additions & 2 deletions src/debug/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ export class ThreadManager {
return this.threads.map((thread: ThreadInfo) => new Thread(thread.num, thread.ref.name));
}

public async setExceptionPauseMode(mode: VmExceptionMode) {
this.exceptionMode = mode;
public async setExceptionPauseMode(mode: VmExceptionMode, persist = true) {
if (persist) {
this.exceptionMode = mode;
}
if (!this.debugSession.vmService)
return;

Expand Down

0 comments on commit 44c44e9

Please sign in to comment.