Description
Several asynchronous code paths use an async function directly as the
executor passed to the Promise constructor:
src/common/packageLoader.ts
src/debugger/rnDebugSession.ts
src/extension/networkInspector/networkInspectorServer.ts
The Promise constructor does not observe the promise returned by an async
executor. An exception thrown after an await can therefore become an
unhandled rejection instead of rejecting the outer promise.
This can result in incomplete initialization, hanging operations, or errors
that bypass the expected error-handling flow.
Expected behavior
All asynchronous failures should reliably reject the promise returned by the
owning operation and reach its existing error handler.
Event-driven operations should retain their current completion semantics while
using a synchronous Promise executor.
Proposed solution
- Keep the Promise executor synchronous in the package loader and debugger
attach flow.
- Explicitly connect asynchronous work to the outer promise with
.catch(reject).
- Replace the unnecessary Promise constructor in the Network Inspector server
with a regular async initialization method.
- Preserve the existing package installation, debugger connection, and
concurrent stop behavior.
Validation
- The project builds with zero errors.
- The modified files have no TypeScript or editor diagnostics.
- Network Inspector tests pass.
- None of the affected code paths use
new Promise(async ...) after the
change.
Description
Several asynchronous code paths use an
asyncfunction directly as theexecutor passed to the
Promiseconstructor:src/common/packageLoader.tssrc/debugger/rnDebugSession.tssrc/extension/networkInspector/networkInspectorServer.tsThe
Promiseconstructor does not observe the promise returned by an asyncexecutor. An exception thrown after an
awaitcan therefore become anunhandled rejection instead of rejecting the outer promise.
This can result in incomplete initialization, hanging operations, or errors
that bypass the expected error-handling flow.
Expected behavior
All asynchronous failures should reliably reject the promise returned by the
owning operation and reach its existing error handler.
Event-driven operations should retain their current completion semantics while
using a synchronous Promise executor.
Proposed solution
attach flow.
.catch(reject).with a regular async initialization method.
concurrent stop behavior.
Validation
new Promise(async ...)after thechange.