microsoft / vscode

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

TS Server fatal error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isUnaryExpression'. #179466

Closed tomnoir closed 1 year ago

tomnoir commented 1 year ago

Type: Bug

❗️❗️❗️ Please fill in the sections below to help us diagnose the issue ❗️❗️❗️

TypeScript Version: 5.0.2

Steps to reproduce crash

  1. Updated to VS Code 1.77 (Typescript 5 update)
  2. Opened React Native .tsx file Disabling other extensions mentioned in the error message did not help.

TS Server Log

❗️ Server logging disabled. To help us fix crashes like this, please enable logging by setting:

"typescript.tsserver.log": "verbose"

After enabling this setting, future crash reports will include the server log.

TS Server Error Stack

Server: semantic

Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isUnaryExpression'.
    at cast (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:3443:16)
    at Object.parenthesizeOperandOfPrefixUnary (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:21786:50)
    at Object.createPrefixUnaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23915:41)
    at parsePrefixUnaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33520:32)
    at parseSimpleUnaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33572:16)
    at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33554:35)
    at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33472:25)
    at parseBinaryExpressionRest (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33498:75)
    at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33473:12)
    at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33145:18)
    at parseArgumentOrArrayLiteralElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34228:170)
    at parseListElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31579:12)
    at parseDelimitedList (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31818:24)
    at parseArrayLiteralExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34241:22)
    at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34178:16)
    at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33655:24)
    at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33649:82)
    at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33624:24)
    at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33550:32)
    at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33472:25)
    at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33145:18)
    at parseArgumentOrArrayLiteralElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34228:170)
    at parseListElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31579:12)
    at parseDelimitedList (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31818:24)
    at parseArrayLiteralExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34241:22)
    at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34178:16)
    at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33655:24)
    at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33649:82)
    at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33624:24)
    at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33550:32)
    at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33472:25)
    at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33145:18)
    at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:33111:16)
    at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:30808:12)
    at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:30829:12)
    at parseExpressionOrLabeledStatement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34623:24)
    at parseStatement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:34855:12)
    at parseListElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31579:12)
    at parseList (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:31564:19)
    at parseSourceFileWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:30624:24)
    at Object.parseSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:30457:20)
    at createSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:30290:21)
    at createLanguageServiceSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:135139:22)
    at acquireOrUpdateDocument (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:132053:26)
    at Object.acquireDocumentWithKey (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:131978:12)
    at getOrCreateSourceFileByPath (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:135464:31)
    at Object.getOrCreateSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:135444:14)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:135376:42
    at Object.getSourceFileWithCache [as getSourceFile] (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:117127:24)
    at findSourceFileWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119460:23)
    at findSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119380:20)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119329:22
    at getSourceFileFromReferenceWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119298:26)
    at processSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119327:5)
    at processRootFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119123:5)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:117908:41
    at forEach (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:2307:22)
    at createProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:117908:5)
    at synchronizeHostData (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:135400:15)
    at Object.getProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:135472:5)
    at ConfiguredProject2.updateGraphWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:172153:41)
    at ConfiguredProject2.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:172090:32)
    at ConfiguredProject2.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:173272:24)
    at _ProjectService.createLoadAndUpdateConfiguredProject (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:174879:13)
    at _ProjectService.assignProjectToOpenedScriptInfo (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:175970:26)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:176250:64
    at flatMap (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:2555:17)
    at _ProjectService.applyChangesInOpenFiles (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:176250:24)
    at updateOpen (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:177395:29)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179962:69
    at IpcIOSession.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179954:14)
    at IpcIOSession.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179962:29)
    at IpcIOSession.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:180004:51)
    at process.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:181571:14)
    at process.emit (node:events:526:28)
    at emit (node:internal/child_process:938:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

VS Code version: Code 1.77.1 (b7886d7461186a5eac768481578c1d7ca80e2d21, 2023-04-04T23:23:33.779Z) OS version: Darwin x64 22.3.0 Modes: Unsupported Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz (8 x 4200)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|9, 6, 3| |Memory (System)|40.00GB (24.42GB free)| |Process Argv|--crash-reporter-id 0a5ab893-1762-4ad5-8c43-acbfd43e2fd0| |Screen Reader|no| |VM|0%|
Extensions (121) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 vscode-sql-formatter|adp|1.4.4 vscode-nginx-conf|ahm|0.1.3 Bookmarks|ale|13.3.1 snip-snip|alx|1.0.0 aws-toolkit-vscode|ama|1.67.0 wallpaper-setting|Ang|0.10.1 vscode-color|ans|0.4.5 tailwind-docs|aus|2.0.0 solidjs|ber|3.0.7 vscode-intelephense-client|bme|1.9.5 vscode-tailwindcss|bra|0.9.11 phpserver|bra|3.0.2 simple-react-snippets|bur|1.2.7 vscode-expo|byC|0.9.2 gltf-vscode|ces|2.3.16 npm-intellisense|chr|1.4.4 path-intellisense|chr|2.8.4 dart-code|Dar|3.62.0 vscode-markdownlint|Dav|0.49.0 vscode-eslint|dba|2.4.0 FreeMarker|dco|0.0.9 composer-php-vscode|DEV|1.33.12924 phptools-vscode|DEV|1.33.12924 profiler-php-vscode|DEV|1.33.12924 githistory|don|0.6.20 xml|Dot|2.5.1 eslint-disable-snippets|drK|1.3.0 es7-react-js-snippets|dsz|4.4.3 rust-syntax|dus|0.6.1 vscode-html-css|ecm|1.13.1 vscode-npm-script|eg2|0.3.29 apacheconf-snippets|eim|1.3.0 react-native-react-redux-snippets-for-es6-es7-version-standard|EQu|1.0.3 prettier-vscode|esb|9.10.4 git-project-manager|fel|1.8.2 vscode-firefox-debug|fir|2.9.8 vscode-jest-runner|fir|0.4.60 auto-close-tag|for|0.5.14 auto-rename-tag|for|0.1.10 vscode-mysql|for|0.4.1 lintlens|ghm|7.2.0 copilot|Git|1.79.10634 vscode-pull-request-github|Git|0.62.0 gitpod-desktop|git|0.0.98 go|gol|0.38.0 todo-tree|Gru|0.0.224 vercel-vscode|hay|1.0.13 prettier-eslint-typescript|hb4|1.0.5 vscode-test-explorer|hbe|2.21.1 vscode-drawio|hed|1.6.6 rest-client|hum|0.25.1 vscode-react-typescript|inf|1.3.1 path-autocomplete|ion|1.23.1 RelativePath|jak|1.5.0 vscode-peacock|joh|4.2.2 react-native-snippet|jun|0.5.6 php-cs-fixer|jun|0.3.9 node-module-intellisense|lei|1.5.0 rainbow-csv|mec|3.6.0 php-namespace-resolver|Meh|1.1.9 vscode-language-babel|mgm|0.0.38 git-graph|mhu|1.30.0 dotenv|mik|1.0.1 theme-monokai-pro-vscode|mon|1.2.0 vscode-apache|mrm|1.2.0 vscode-docker|ms-|1.24.0 kind-vscode|ms-|0.0.3 vscode-kubernetes-tools|ms-|1.3.11 playwright|ms-|1.0.10 isort|ms-|2022.8.0 python|ms-|2023.6.0 vscode-pylance|ms-|2023.4.10 remote-containers|ms-|0.288.0 remote-ssh|ms-|0.98.0 remote-ssh-edit|ms-|0.84.0 azure-account|ms-|0.11.3 makefile-tools|ms-|0.6.0 remote-explorer|ms-|0.4.0 test-adapter-converter|ms-|0.1.7 vsliveshare|ms-|1.0.5834 vscode-react-native|msj|1.10.2 go-doc|msy|1.0.1 sqltools|mtx|0.27.1 sqltools-driver-mysql|mtx|0.5.1 color-highlight|nau|2.5.0 php-docblocker|nei|2.7.0 vscode-jest|Ort|5.2.3 vscode-phpcbf|per|0.0.8 vscode-versionlens|pfl|1.5.0 zeit-co-vscode-schemas|ph1|0.1.2 prisma|Pri|4.12.0 vscode-rapidapi-client|Rap|1.10.1 vscode-services|rap|1.0.0 nginx-formatter|ray|0.0.13 vscode-yaml|red|1.12.2 format-html-in-php|rif|1.7.0 rust-analyzer|rus|0.3.1463 vs-code-prettier-eslint|rve|5.1.0 background|sha|1.2.9 trailing-spaces|sha|0.4.1 swdc-vscode|sof|2.7.0 sass-indented|syl|1.8.26 bootstrap4-vscode|the|6.1.0 pdf|tom|1.2.2 vscode-phpsab|val|0.0.16 intellicode-api-usage-examples|Vis|0.2.7 vscode-icons|vsc|12.2.0 vscode-todo-highlight|way|1.0.5 twig|wha|1.0.2 vscode-nginx|wil|0.7.2 vscode-go-autotest|win|1.6.0 fig|wit|0.0.7 vscode-import-cost|wix|3.3.0 eno|Wsc|2.3.53 php-debug|xde|1.32.1 php-pack|xde|1.0.3 markdown-all-in-one|yzh|3.5.1 material-theme|zhu|3.15.8 html-css-class-completion|Zig|1.20.0 php-intellisense|zob|1.1.2 (8 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 vstes263:30335439 vscorecescf:30445987 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 nodejswelcome1:30587005 3biah626:30602489 pyind779:30671433 89544117:30613380 pythonsymbol12:30671437 2i9eh265:30646982 vsccsb:30705552 pythonb192cf:30669361 functionswalk:30687959 pythonms35:30701012 pythonclientmvcf:30705674 ```
gjsjohnmurray commented 1 year ago

/duplicate of #179399

vscodenpa commented 1 year ago

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!