microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.22k stars 29.29k forks source link

Cannot break on uncaught exception when using finally. #194291

Closed cesaryuan closed 1 year ago

cesaryuan commented 1 year ago

Type: Bug

  1. Open VS Code
  2. Uncheck the Caught Exceptions checkbox in the "Breakpoints" pane of the debugger
  3. Check the Uncaught Exceptions checkbox in the "Breakpoints" pane of the debugger
  4. Copy, compile and run the snippet below
  5. Notice that VS Code cannot break on the error thrown by test()
async function test() {
    await 0
    throw new Error('')
}

test().finally(() => {
    console.log('finally')
})

However, after some changes, VS Code now can break.

let p = new Promise(async () => {
    await 0
    throw new Error('')
})

p.finally(() => {
    console.log('finally')
})

VS Code version: Code 1.82.2 (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:55:25.390Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz (12 x 3598)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|63.91GB (34.31GB free)| |Process Argv|--crash-reporter-id 232c4e71-71ce-4b2d-b368-c38367e676b7| |Screen Reader|no| |VM|21%|
Extensions (125) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 vscode-m3u|af4|1.0.0 matlab-formatter|Aff|2.11.0 Bookmarks|ale|13.4.1 file-nesting|ant|1.1.2 vscode-zipfs|arc|3.0.0 toml|be5|0.6.0 markdown-preview-github-styles|bie|2.0.3 turbo-console-log|Cha|2.9.6 npm-intellisense|chr|1.4.4 codeque|Cod|0.27.0 workspace-archive|Cod|1.0.24 gitignore|cod|0.9.0 macos-modern-theme|dav|2.3.19 vscode-eslint|dba|2.4.2 vscode-deno|den|3.24.0 docs-yaml|doc|1.0.1 githistory|don|0.6.20 python-environment-manager|don|1.2.4 python-extension-pack|don|1.7.0 xml|Dot|2.5.1 dprint|dpr|0.15.0 EditorConfig|Edi|0.16.4 vscode-npm-script|eg2|0.3.29 vscode-great-icons|emm|2.1.102 prettier-vscode|esb|10.1.0 code-runner|for|0.12.0 godot-tools|gee|1.3.1 codespaces|Git|1.15.4 copilot|Git|1.116.440 copilot-chat|Git|0.7.1 copilot-labs|Git|0.15.1019 remotehub|Git|0.60.0 vscode-github-actions|git|0.26.2 vscode-pull-request-github|Git|0.72.0 live-sass|gle|6.1.1 go|gol|0.39.1 gc-excelviewer|Gra|4.2.58 todo-tree|Gru|0.0.226 vscode-mocha-test-adapter|hbe|2.14.1 vscode-test-explorer|hbe|2.21.1 yaml-plus-json|hil|1.12.1 output-colorizer|IBM|0.1.2 path-autocomplete|ion|1.25.0 open-file-from-path|jac|1.3.4 latex-workshop|Jam|9.14.0 vscode-edit-csv|jan|0.8.2 webpack|jer|3.0.2 svg|joc|1.5.3 jshook-vscode-extension|Jso|1.0.3 vsc-python-indent|Kev|1.18.0 vscode-gutter-preview|kis|0.30.0 vscode-format-context-menu|lac|1.0.4 vscode-settings-editor|lir|1.0.2 smalise|Loy|0.0.12 vscode-fluent|mac|1.0.0 bash-ide-vscode|mad|1.39.0 vscode-autohotkey-plus-plus|mar|5.0.3 marp-vscode|mar|2.7.0 rainbow-csv|mec|3.7.1 template-string-converter|meg|0.6.1 git-graph|mhu|1.30.0 vscode-filesize|mkx|3.1.0 vscode-scss|mrm|0.10.0 vscode-docker|ms-|1.26.1 vscode-language-pack-zh-hans|MS-|1.82.2023091309 playwright|ms-|1.0.15 python|ms-|2023.17.6269198447-dev vscode-pylance|ms-|2023.9.20 jupyter|ms-|2023.8.1002501831 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.17 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 remote-ssh|ms-|0.106.4 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.81.4 cmake-tools|ms-|1.15.31 cpptools|ms-|1.17.5 cpptools-extension-pack|ms-|1.3.0 live-server|ms-|0.5.2023092601 makefile-tools|ms-|0.7.0 remote-explorer|ms-|0.4.1 remote-repositories|ms-|0.38.1 remote-server|ms-|1.4.3 test-adapter-converter|ms-|0.1.8 vscode-json-editor|nic|0.3.0 fix-json|oli|0.1.2 vscode-gitignore-generator|pio|1.0.3 git-file-history|pom|1.0.1 vala|pri|1.0.8 sqlite-viewer|qwt|0.3.13 sass-helper|ram|0.0.2 vscode-yaml|red|1.14.0 echarts-enhanced-completion|ren|1.6.5 vscode-statusbar-json-path|ric|2.0.0 rust-analyzer|rus|0.3.1673 vscode-javascript-booster|sbu|14.0.1 vscode-vba|ser|0.9.3 markdown-preview-enhanced|shd|0.7.10 apklab|Sur|1.7.0 svelte-vscode|sve|107.11.0 sass-indented|syl|1.8.28 language-stylus|sys|1.16.0 even-better-toml|tam|0.19.2 tauri-vscode|tau|0.2.6 vscode-markdown-paste-image|tel|1.0.1 shellcheck|tim|0.34.0 pdf|tom|1.2.2 cmake|twx|0.0.17 vscode-lldb|vad|1.10.0 intellicode-api-usage-examples|Vis|0.2.8 vscode-gradle|vsc|3.12.7 vscode-icons|vsc|12.5.0 volar|Vue|1.8.15 vscode-typescript-vue-plugin|Vue|1.8.15 vscode-json-path|wei|2.4.0 snippet-generator|wen|0.3.6 vscode-import-cost|wix|3.3.0 JavaScriptSnippets|xab|1.8.0 five-server|yan|0.2.3 pretty-ts-errors|yoa|0.5.2 city-lights-icon-vsc|Yum|1.1.3 mplstyle|yy0|1.14.1 markdown-pdf|yza|1.5.0 (7 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30695312 azure-dev_surveyone:30548225 2e4cg342:30602488 f6dab269:30613381 2i9eh265:30646982 showlangstatbar:30737416 03d35959:30757346 pythonfmttext:30731395 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30797651 pythonidxptcf:30805731 pythonnoceb:30805159 copilotsettingc:30839828 dsvsc013:30795093 dsvsc014:30804076 diffeditorv1:30821571 dsvsc015:30845448 ```
roblourens commented 1 year ago

I see the same in chrome devtools, so it's probably not something that we can change on our end

connor4312 commented 1 year ago

Indeed, I suggest verifying this happens on Chrome Canary and reporting this on https://bugs.chromium.org/p/chromium/issues/list