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

Intellisense configuration error: Cannot read properties of null (reading 'replace') #13220

Closed
The-oldone opened this issue Feb 1, 2025 · 2 comments · Fixed by #13224
Closed
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix regression A bug that didn't exist in a previous release
Milestone

Comments

@The-oldone
Copy link

Environment

  • OS and Version: Windows Version 24H2
  • VS Code Version: 1.96.4
  • C/C++ Extension Version: 1.23.5

Bug Summary and Steps to Reproduce

Bug Summary:
I installed MinGW on my machine and switched to its g++ compiler (not mingw-w64, the older one). Later, I decided to switch back to cl, and proceeded to change my intellisense configuration but vscode reported an error saying command 'c/c++: select intellisense configuration' resulted in an error. Cannot read properties of null (reading 'replace'). Ever since, trying to change my intellisense compiler or getting the template for project specific intellisense configuration(c_cpp_properties.json) alternates randomly between resulting in this error and doing nothing. The only thing that happens when I do so is settings.json being created with "C_Cpp.default.compilerPath" set to whatever I had previously set it to.

Steps to reproduce:

  1. Install MinGW(not mingw-w64) from sourceforge and change the path variable to include it.
  2. Open code without a folder open and use show and run commands and select "c/c++ select intellisense configuration"
  3. Change the compiler to g++ and back to cl
  4. The error should occur at this point. If not, try doing it with a folder open

Expected behavior:
The IDE should switch back to cl and give the template for c_cpp_properties.json as normal

Configuration and Logs

NOTE: I have replaced my name with <my name> for privacy reasons
-------- Diagnostics - 2/1/2025, 2:55:48 PM
Version: 1.23.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/mybkp/coding/test/test111/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22000.0",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPath": "",
    "compilerPathIsExplicit": true,
    "browse": {
        "path": [
            "c:/mybkp/coding/test/test111/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.compilerPath": ""
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": false,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": true,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.23.5.0
Current database path: C:\USERS\<my name>\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\BC0DBC604740159877D3088001068A05\.BROWSE.VC.DB
No active translation units.

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

Other Extensions

  • c/c++ extension pack
  • c/c++ themes
  • .NET install tool
  • asm code lens
  • blackbox ai
  • c#
  • c#dev kit
  • cmake
  • cmake tools
  • debugger for firefox
  • debugger for java
  • extension pack for java
  • gdscript
  • github pull requests
  • GitLens — Git supercharged
  • Gradle for Java
  • intellicode
  • IntelliCode API Usage Examples
  • Language Support for Java(TM) by Red Hat
  • java
  • markdownlint
  • Material Icon Theme
  • Maven for Java
  • PowerShell
  • pretty.gd
  • Preview on Web Server
  • Print
  • Project Manager for Java
  • Python
  • pylance
  • python debugger
  • r
  • Runme Notebooks for DevOps
  • Shader languages support for VS Code
  • Test Runner for Java
  • vscode-pdf
  • XML Tools

The issue stays after disabling all other extensions except c/c++ extension pack and c/c++ themes

Additional context

At a point around the time the bug started, I changed the default compiler path in extension settings.json to the x64 version despite the x86 version being chosen by default. This might have contributed to it

@sean-mcmanus sean-mcmanus self-assigned this Feb 3, 2025
@sean-mcmanus sean-mcmanus added bug Language Service quick fix regression A bug that didn't exist in a previous release labels Feb 3, 2025
@sean-mcmanus sean-mcmanus added this to the 1.24.0 milestone Feb 3, 2025
@github-project-automation github-project-automation bot moved this to Done in cpptools Feb 3, 2025
@sean-mcmanus sean-mcmanus modified the milestones: 1.24.0, 1.23.6 Feb 3, 2025
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Feb 3, 2025
@bobbrow bobbrow moved this from Done to In progress in cpptools Feb 3, 2025
@sean-mcmanus sean-mcmanus moved this from In progress to Done in cpptools Feb 6, 2025
@sean-mcmanus
Copy link
Contributor

@The-oldone
Copy link
Author

@sean-mcmanus thanks!
Just a confirmation, using select intellisense configuration doesn't create a c_cpp_properties file right?
Currently it only creates a settings.json with the default compiler changed to the one I select in the menu displayed for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix regression A bug that didn't exist in a previous release
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants