microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.94k stars 12.47k forks source link

TS Server fatal error: Cannot read property 'charCount' of undefined #44492

Closed Viriatto closed 2 months ago

Viriatto commented 3 years ago

Issue Type: Bug

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

TypeScript Version: 4.3.2

Steps to reproduce crash Was coding normally, no out of ordinary combination of steps.

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: syntax

TypeError: Cannot read property 'charCount' of undefined
    at LineNode.walk (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165938:68)
    at LineIndex.edit (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165819:31)
    at ScriptVersionCache._getSnapshot (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165609:47)
    at ScriptVersionCache.lineOffsetToPosition (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165628:29)
    at TextStorage.lineOffsetToPosition (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:156859:33)
    at ScriptInfo.lineOffsetToPosition (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:157223:41)
    at c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:163297:56
    at Object.next (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:629:33)
    at ProjectService.applyChangesToFile (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:162253:46)
    at ProjectService.applyChangesInOpenFiles (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:162220:30)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:163288:46)
    at c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165205:88
    at IOSession.Session.executeWithRequestId (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165196:28)
    at IOSession.Session.executeCommand (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165205:33)
    at IOSession.Session.onMessage (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:165231:35)
    at Interface.<anonymous> (c:\Users\João Teixeira\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:167833: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 - Insiders 1.57.0-insider (fe1eafc80c07608de52a2f9c99fee103dea77f5e, 2021-06-04T12:21:40.077Z) OS version: Windows_NT x64 10.0.19043

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz (4 x 2496)| |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.89GB (2.24GB free)| |Process Argv|--crash-reporter-id 98a18f25-ca20-447f-9a7d-5b1eb68d9713| |Screen Reader|no| |VM|0%|
Extensions (6) Extension|Author (truncated)|Version ---|---|--- vscode-eslint|dba|2.1.20 discord-vscode|icr|5.6.3 dotenv|mik|1.0.1 discordjs-helper|Sno|1.0.3 vscode-icons|vsc|11.4.0 material-theme|zhu|3.10.14
A/B Experiments ``` vsliv695:30137379 vsins829:30139715 vsliv368cf:30146710 vsreu685:30147344 python383:30185418 pythonvspyt602:30291494 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyt639:30291487 pythontb:30258533 vspre833:30267464 pythonptprofiler:30281269 vshan820:30294714 vscorecescf:30290706 pythondataviewer:30285072 vscus158:30286553 pythonvsuse255:30303025 vscgsv2:30305091 vscorehov:30301224 vscod805:30301674 vscextlang:30310088 vsccppwt:30312692 ```
vscodebot[bot] commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

RyanCavanaugh commented 3 years ago

We need the source code that reproduces this error

Viriatto commented 3 years ago

Unfortunately, I do not have the source code that reproduced this error anymore but I will report it again with the source code if it happens in the future.