microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

"Catastrophic error: internal error" occurs during tag parsing #8851

Closed lifw555 closed 2 years ago

lifw555 commented 2 years ago

Bug type: Debugger

Describe the bug

To Reproduce Please include a code sample and launch.json configuration. Steps to reproduce the behavior:

  1. Go to 'install vscode and install cpptools'
  2. Click on 'create cpp file, two funcitons'
  3. can not navigation function
  4. See error image

link vscode issue: https://github.com/microsoft/vscode/issues/142945

Additional context If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json Add any other context about the problem here including log or error messages in your Debug Console or Output windows.

lifw555 commented 2 years ago

if use C/C++ version 1.7.1

vscode 1.64.2 works fine. all vscode version works fine.

if use 1.8.x not work, i check the different:

with 1.7.1 log (1.8.4 log not have):


Updating C / C + + dependencies

Downloading package "C / C + + language components (Windows)" (7809 KB) complete! Downloading package "clangformat (Windows x64)" (861 KB) complete! Downloading package "opendebugad7 (Windows x86 / x64)" (28081 KB) complete! Downloading package "Visual Studio windows debugger" (14244 KB) complete!

Installing package "C / C + + language components (Windows)" Installing package 'clangformat (Windows x64)' Installing package "opendebugad7 (Windows x86 / x64)" Installing package 'Visual Studio windows debugger' Finished installing dependencies


lifw555 commented 2 years ago

i hope this info is useful to u.

sean-mcmanus commented 2 years ago

Yeah, seems like a regression with our tag parser. We're still stumped as to how it could be possible though. This is the 1st report we've seen of this. There may be something unusual with your setup?

lifw555 commented 2 years ago

i use the default setting

vscode 1.65.0, use 1.8.4 not work , but 1.7.1 works fine.

sean-mcmanus commented 2 years ago

Can you check if your C:\Users\<username>\.vscode\extensions\ms-vscode.cpptools-1.8.4\bin folder has 55 files? It's possible something may be consistently preventing files from getting installed at that location.

heartacker commented 2 years ago

a2a216006bd84499883242ba24e8c0ed same problem here with 1.9.0

heartacker commented 2 years ago

we try to back to 1.8.5. and we still have the same problem

sean-mcmanus commented 2 years ago

Can someone check if the database is being created and what size it is? such as by setting "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/vc.db" ?

lifw555 commented 2 years ago

use 1.7.1, it works.

lifw555 commented 2 years ago

Can you check if your C:\Users\<username>\.vscode\extensions\ms-vscode.cpptools-1.8.4\bin folder has 55 files? It's possible something may be consistently preventing files from getting installed at that location.

yes , 55 files exists.

lifw555 commented 2 years ago

Can someone check if the database is being created and what size it is? such as by setting "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/vc.db" ?

D:\projects_vscode\h3.vscode\VC.DB

932 KB (954,368 byte)

sean-mcmanus commented 2 years ago

The user in issue https://github.com/microsoft/vscode-cpptools/issues/8807 appears to be hitting the same issue (causing recursive includes to fail).

@lifw555 Seems like the database is okay, just tag parsing is failing.

sean-mcmanus commented 2 years ago

Can someone check whether or not a file with only "int i;" does not parse correctly with no "i" symbol in the Outline view? It seems like all the previous screenshots show a #include line at the top.

sean-mcmanus commented 2 years ago

Also, can someone upload the physical file that is used? (with any small repro code)?

Also, can someone check their currently set "code page"? I think via the screenshot below, but I'm still confirming if that's the correct setting... image

lifw555 commented 2 years ago

Can someone check whether or not a file with only "int i;" does not parse correctly with no "i" symbol in the Outline view? It seems like all the previous screenshots show a #include line at the top.

only "int i;", it not work too.

lifw555 commented 2 years ago

not English

image

lifw555 commented 2 years ago

image

lifw555 commented 2 years ago

Ah, another computer install windows 11 , and vscode 1.64.2 , cpp ext 1.8.4

it works fine .

sean-mcmanus commented 2 years ago

That looks like "Chinese (Simplified), China" -- we have a team that understands Chinese so I'll see if they can repro this via changing their code page and/or OS language.

sean-mcmanus commented 2 years ago

@lifw555 Does the machine that work have a Chinese or English code page set? What other difference is there between those machines? Our team has both Windows 10 and 11.

lifw555 commented 2 years ago

No difference, all Chinese code page set

sean-mcmanus commented 2 years ago

Okay, maybe there's some OS difference. If you could update your Win10 machine to the latest Win10 updates that could help (might be an OS bug that is fixed with Win11 or a Win10 update).

lifw555 commented 2 years ago

Okay, maybe there's some OS difference. If you could update your Win10 machine to the latest Win10 updates that could help (might be an OS bug that is fixed with Win11 or a Win10 update).

Now it's the latest。

sean-mcmanus commented 2 years ago

@lifw555 You mean the bug still repros with Win10 patched with updates?

FYI, a few months ago we hit bug https://github.com/microsoft/vscode-cpptools/issues/8312 which was caused by a bug in the Ryzen 6300 BIOS and a workaround was to update the BIOS.

lifw555 commented 2 years ago

yes,still repros 。

sean-mcmanus commented 2 years ago

Is it possible some virus scan or external program could be interfering?

Another potential thing that could be done is to run something like process monitor on our cpptools process ( https://docs.microsoft.com/en-us/sysinternals/downloads/procmon ) and looking for unexpected errors on the repro machine and/or comparing the results with a machine that doesn't repro the issue to determine what is unexpected. I'm guessing some Windows system call is failing that is not expected -- if we know which Windows system call is failing, we might be able to detect that case and fix or workaround it. We can't do this procmon investigation ourselves because we don't have a machine that repros this yet.

sean-mcmanus commented 2 years ago

Another potential thing to look for is any path or username difference between the repro machine and the non-repro machine.

sean-mcmanus commented 2 years ago

We're adding tag parser error logging for 1.9.1 (insiders2) which may help diagnose the cause: https://github.com/microsoft/vscode-cpptools/issues/8907

UPDATE: Logging got delayed to 1.9.2.

lifw555 commented 2 years ago

C/C++ v1.9.1 IntelliSense process crash detected.

sean-mcmanus commented 2 years ago

@lifw555 An IntelliSense process crash with 1.9.1 is most likely a new unrelated issue (we haven't yet heard of any new IntelliSense crash regressions with that version, although we're aware of a new main process crash that should be fixed in our pending 1.9.2). Can you file a bug with more repro info, such as a repro code or a crash call stack from attaching to cpptools-srv before the crashing code is used?

lifw555 commented 2 years ago

got error:

[2022-03-03 08:40:09.128] [renderer1] [error] [Extension Host] (node:13420) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Use Code --trace-deprecation ... to show where the warning was created) [2022-03-03 08:40:59.953] [renderer1] [error] Could not find category with ID: ms-vscode.cpptools#cppWelcome: Error: Could not find category with ID: ms-vscode.cpptools#cppWelcome at vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:2820:93977 at o.fire (vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:67:1712) at N.progressStep (vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1710:28659) at N.registerDoneListeners (vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1710:31199) at vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1710:29517 at Array.forEach () at N._registerWalkthrough (vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1710:29299) at vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1710:26684 at async Promise.all (index 0) at async N.registerExtensionWalkthroughContributions (vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1710:24220) at async Promise.all (index 0) at async m._handler (vscode-file://vscode-app/c:/VSCode/resources/app/out/vs/workbench/workbench.desktop.main.js:1710:20596) [2022-03-03 08:42:34.379] [renderer1] [warning] Settings pattern "keyboard.*" doesn't match any settings

sean-mcmanus commented 2 years ago

@lifw555 All those errors are unrelated to this parsing bug. Are you using 1.9.2? Did the "[error] Could not find category with ID: ms-vscode.cpptools#cppWelcome: Error: Could not find category with ID: ms-vscode.cpptools#cppWelcome" cause a popup UI to appear? @jureid @Colengms Any ideas about this?

lifw555 commented 2 years ago

yes, 1.9.2

lifw555 commented 2 years ago

another pc (win10),upgrade to 1.9.2, it works

How to uninstall completely all ?(app cache config etc。)

i will try again 。

sean-mcmanus commented 2 years ago

How to uninstall VS Code completely? I've seen pages online describing steps.

lifw555 commented 2 years ago

after reinstall , it not works too.

heartacker commented 2 years ago

HI all: I test and test again and again. finally,

sean-mcmanus commented 2 years ago

@heartacker 1.8.0-insiders2 included several parsing updates/fixes, which could be the cause of the regression. We're hoping the pending tag parser error logging will shed light on what is going wrong.

sean-mcmanus commented 2 years ago

We've added tag parser error logging with 1.9.3 (Pre-Release) with C_Cpp.loggingLevel set to "Warning" or greater. You should see some text like

  tag parsing file: <path>
    tag parsing error (this can be ignored unless symbols can't be found):
    line 8 (col. 8): error: incorrectly formed universal character name

in the C/C++ logging pane. Can someone try that and report what error message is being shown?

sean-mcmanus commented 2 years ago

A user in another thread reported "Catastrophic error: internal error", so I assume that's the same error message everyone else is seeing if they hit this issue. Looking into it...

zhang24xiao commented 2 years ago

A user in another thread reported "Catastrophic error: internal error", so I assume that's the same error message everyone else is seeing if they hit this issue. Looking into it... VSCodeParseFails.txt

Same error here with v1.9.3Pre-Release version.

sean-mcmanus commented 2 years ago

Can someone try the vsix at https://github.com/microsoft/vscode-cpptools/releases/tag/v1.9.4-debug (i.e. https://github.com/microsoft/vscode-cpptools/releases/download/v1.9.4-debug/cpptools-win64.vsix ) and report the debug assertion message that occurs from the tag parsing? That info should help us fix this issue. It may look something like:

image

I assume everyone repros this on Windows x64, but we can publish other OS versions if someone has another repro OS.

heartacker commented 2 years ago

image

image

sean-mcmanus commented 2 years ago

@heartacker Do you see .vscode\extensions\ms-vscode.cpptools-1.9.4-debug\bin\vcmeta.dll installed (i.e. in the same directory as cpptools)? It's supposed to be installed with the vsix. I get that same error if I delete that file. Either something is causing it to be deleted from your machine, not installed as it should, or something is causing the path it searches for the DLL to be incorrect.

sean-mcmanus commented 2 years ago

@heartacker Oh, I get the "can't find" message if that DLL is missing not the other one -- I'm looking into what could cause the "failed to find suitable" assertion to fail.

UPDATE: Oh, no, I do get both asserts.

sean-mcmanus commented 2 years ago

The vcmeta.dll is only used for parsing C++/CX (even if that language variant isn't actually used) -- one potential workaround would be to just disable that parsing mode when the DLL fails to load, but ideally we could figure out why it's not loading.

sean-mcmanus commented 2 years ago

Can someone verify if that DLL exists or not next to the binary?

sean-mcmanus commented 2 years ago

Ah, I'm guessing the DLL may fail to load due to another Windows DLL dependency that is somehow missing from your Windows installation. The bin folder has a number of other DLLs that are dependencies in order to try to deal with any potential DLLs that aren't installed, but it's possible that we somehow acquired an additional dependency, i.e. we may need to add more DLLs to that folder.

sean-mcmanus commented 2 years ago

I'm guessing you don't have VS 2022 installed? It looks like some DLL dependencies from that may be required. vcmetal.dll ships with the cl.exe compiler (in the same folder) which also includes other DLLs that we're not bundling correctly.

sean-mcmanus commented 2 years ago

I'm going to build a new release vsix with vcruntime140_1.dll added and updated versions of msvcp140.dll and vcruntime140.dll.