microsoft / vscode

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

TS Server fatal error: Cannot read property 'flags' of undefined #140535

Closed wuzhonghao1 closed 2 years ago

wuzhonghao1 commented 2 years ago

Issue Type: Bug

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

TypeScript Version: 4.5.4

Steps to reproduce crash 1. 2. 3.

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

TypeError: Cannot read property 'flags' of undefined
    at getPropertyOfObjectType (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:57011:22)
    at getPropertyOfType (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:57671:24)
    at resolveESModuleSymbol (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49817:54)
    at getTargetOfNamespaceImport (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49002:28)
    at getTargetOfAliasDeclaration (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49236:28)
    at resolveAlias (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49281:30)
    at getSymbol (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:47838:38)
    at resolveNameHelper (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:48131:34)
    at resolveName (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:48114:20)
    at resolveEntityName (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49453:42)
    at getTargetOfAliasLikeExpression (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49210:29)
    at getTargetOfExportAssignment (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49199:28)
    at getTargetOfAliasDeclaration (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49246:28)
    at resolveAlias (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49281:30)
    at resolveSymbol (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49271:67)
    at resolveExternalModuleSymbol (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49763:36)
    at getTargetOfNamespaceExportDeclaration (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49186:28)
    at getTargetOfAliasDeclaration (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49248:28)
    at resolveAlias (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49281:30)
    at resolveSymbol (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:49271:67)
    at mergeSymbol (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:47624:42)
    at d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:47739:47
    at Map.forEach (<anonymous>)
    at mergeSymbolTable (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:47737:20)
    at initializeTypeChecker (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:85010:21)
    at Object.createTypeChecker (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:47395:9)
    at Object.getTypeChecker (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:114404:79)
    at synchronizeHostData (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:159898:21)
    at Proxy.getProgram (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:160019:13)
    at ConfiguredProject.Project.updateGraphWorker (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165033:53)
    at ConfiguredProject.Project.updateGraph (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:164962:42)
    at ConfiguredProject.updateGraph (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165955:63)
    at ProjectService.createLoadAndUpdateConfiguredProject (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:167679:25)
    at ProjectService.assignProjectToOpenedScriptInfo (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:168762:44)
    at d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:169102:97
    at Object.flatMap (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:522:25)
    at ProjectService.applyChangesInOpenFiles (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:169102:41)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:170260:46)
    at d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:172193:88
    at IOSession.Session.executeWithRequestId (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:172184:28)
    at IOSession.Session.executeCommand (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:172193:33)
    at IOSession.Session.onMessage (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:172219:35)
    at Interface.<anonymous> (d:\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:174824:31)
    at Interface.emit (events.js:315:20)
    at Interface._onLine (readline.js:337:10)
    at Interface._normalWrite (readline.js:482:12)
    at Socket.ondata (readline.js:194:10)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)

VS Code version: Code 1.63.2 (899d46d82c4c95423fb7e10e68eba52050e30ba3, 2021-12-15T09:40:02.816Z) OS version: Windows_NT x64 10.0.18363 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 x 1800)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|7.90GB (1.97GB free)| |Process Argv|--crash-reporter-id c8a8c063-1003-4755-9dcc-9efae5513f52| |Screen Reader|no| |VM|0%|
Extensions (65) Extension|Author (truncated)|Version ---|---|--- xml2json|bui|1.2.4 npm-intellisense|chr|1.4.0 path-intellisense|chr|2.6.0 compulim-vscode-closetag|Com|1.2.0 javascript-ejs-support|Dig|1.3.1 es7-react-js-snippets|dsz|3.1.1 vscode-spring-boot|ecm|0.0.10 vscode-npm-script|eg2|0.3.23 vscode-uppercasesql|epl|2.1.4 prettier-vscode|esb|9.1.0 auto-close-tag|for|0.5.13 auto-complete-tag|for|0.1.0 auto-rename-tag|for|0.1.9 code-runner|for|0.11.6 vscode-lombok|Gab|1.0.1 gc-excelviewer|Gra|4.0.50 todo-tree|Gru|0.0.214 vscode-drawio|hed|1.6.4 vue-snippets|hol|1.0.4 rest-client|hum|0.24.6 vue|jcb|0.1.5 volar|joh|0.30.2 vscode-typescript-vue-plugin|joh|0.30.2 intellij-idea-keybindings|k--|1.5.0 react-style-classname-hint|lov|1.0.1 mp-rest-client-generator-vscode-ext|Mic|0.1.2 mp-starter-vscode-ext|Mic|0.2.7 vscode-microprofile-pack|Mic|0.1.3 vscode-language-pack-zh-hans|MS-|1.63.3 python|ms-|2021.12.1559732655 vscode-pylance|ms-|2022.1.0 jupyter|ms-|2021.11.1001550889 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.4 debugger-for-chrome|msj|4.13.0 vuejs-extension-pack|mub|1.6.0 vetur|oct|0.35.0 arma-dev|ole|0.0.20 vuehelper|oys|0.1.0 vscode-boot-dev-pack|Piv|0.1.0 vscode-concourse|Piv|1.29.0 vscode-manifest-yaml|Piv|1.29.0 vscode-spring-boot|Piv|1.29.0 vscode-css-peek|pra|4.2.0 minapp-vscode|qiu|2.4.6 fabric8-analytics|red|0.3.5 java|red|1.2.0 vscode-commons|red|0.0.6 vscode-community-server-connector|red|0.25.2 vscode-rsp-ui|red|0.23.11 vscode-xml|red|0.18.2 vscode-status-bar-format-toggle|tom|3.0.0 vscodeintellicode|Vis|1.2.15 vscode-java-debug|vsc|0.37.0 vscode-java-dependency|vsc|0.18.9 vscode-java-pack|vsc|0.20.0 vscode-java-test|vsc|0.33.1 vscode-maven|vsc|0.34.2 vscode-spring-boot-dashboard|vsc|0.2.0 vscode-spring-initializr|vsc|0.8.0 vscode-icons|vsc|11.8.0 quokka-vscode|Wal|1.0.435 vscode-todo-highlight|way|1.0.5 JavaScriptSnippets|xab|1.8.0 blade-runner|yuk|1.0.0
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 pythontb:30283811 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805:30301674 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 vsc1dst:30421291 pythonvs932:30410667 vscop804:30404766 vs360:30404995 vsrem710cf:30416617 vsccppwtstudy:30421978 ```
yume-chan commented 2 years ago

Duplicate of Microsoft/TypeScript#47179

IllusionMH commented 2 years ago

Please try to install https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-next and see if problem is still reproducible.

Fix should be in latest TS Nightly version.