Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language Server crashes when CTRE is in view #12060

Closed
nixxquality opened this issue Mar 5, 2024 · 2 comments
Closed

Language Server crashes when CTRE is in view #12060

nixxquality opened this issue Mar 5, 2024 · 2 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service reliability verified Bug has been reproduced
Projects
Milestone

Comments

@nixxquality
Copy link

Environment

  • OS and Version: Windows 10
  • VS Code Version: 1.87.0
  • C/C++ Extension Version: v1.19.5

Bug Summary and Steps to Reproduce

Bug Summary:
I wanted to try the interesting looking https://github.com/hanickadot/compile-time-regular-expressions project, so I downloaded the single header version and put it in my workspace. The C++ language server immediately crashes and refuses to work as long as the header is in view.

Steps to reproduce:

  1. Open a new, empty folder in VS Code.
  2. Create a new main.cpp file and enter your favorite Hello world
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world" << endl;
}
  1. Download the single header version of CTRE: https://raw.githubusercontent.com/hanickadot/compile-time-regular-expressions/main/single-header/ctre.hpp
  2. Put ctre.hpp in the folder
  3. The language server will immediately crash and fail to recover as long as ctre.hpp is in the folder

Configuration and Logs

c_cpp_properties.json is default, because it happens in a new folder as well.

-------- Diagnostics - 3/5/2024, 11:25:44 AM
Version: 1.19.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Users/Linus/Code/basic test/**",
        "C:/Users/Linus/Code/vcpkg/installed/x64-windows/include",
        "C:/Users/Linus/Code/vcpkg/installed/x86-windows/include"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22000.0",
    "compilerPath": "cl.exe",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "compilerPathInCppPropertiesJson": "cl.exe",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "c:/Users/Linus/Code/basic test/**",
            "C:/Users/Linus/Code/vcpkg/installed/x64-windows/include",
            "C:/Users/Linus/Code/vcpkg/installed/x86-windows/include",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.19.5.0
No active translation units.

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5356

There's nothing of interest even with debug logging, it's just a bunch of junk and then it ends and restarts after printing

  tag parsing file: C:\Users\Linus\Code\basic test\ctre.hpp


### Other Extensions

_No response_

### Additional context

_No response_
@bobbrow
Copy link
Member

bobbrow commented Mar 5, 2024

Thank you for the easy repro steps. I took a quick look at it this morning. This code suffers from an issue caused by how our indexer works. To work around the crash until we can come up with a patch for this, you can replace the closing curly brace on line 3561 of ctre.hpp with the following:

#if CTRE_CNTTP_COMPILER_CHECK
	}
#else
	}
#endif

@nixxquality
Copy link
Author

Thank you for the workaround. That will do for now :)

@sean-mcmanus sean-mcmanus added this to the 1.19.7 milestone Mar 8, 2024
@sean-mcmanus sean-mcmanus added this to Triage in 1.20 via automation Mar 8, 2024
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Mar 8, 2024
@sean-mcmanus sean-mcmanus moved this from Triage to Done in 1.20 Mar 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service reliability verified Bug has been reproduced
Projects
No open projects
1.20
Done
Development

No branches or pull requests

4 participants