Help me please. Connection to server got closed

Hello. I have Windows 7. Motherboard Nucleo f767. Errors in the screenshot. Code search does not work (f12)


As well as strange paths in the settings file.

I have the same error on Windows 10!
A couple of updates happened recently both to Visual Studio Code and to Windows itself. Maybe they were the cause?

It looks like The language server crashed 5 times in the last 3 minutes. · Issue #2453 · microsoft/vscode-cpptools · GitHub and The C/Cpp Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted · Issue #3104 · microsoft/vscode-cpptools · GitHub
The extension crashes when it is passed 8.3 filenames. The question is, why PlatformIO passes 8.3 filenames to this extension instead of full ones?

Here’s my c_cpp_properties.json from the project:

{
    "!!! WARNING !!!": "PLEASE DO NOT MODIFY THIS FILE! USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags",
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/.platformio/packages/framework-mbed",
                "c:/Temp/Platformio Projects/readermbed/.pioenvs/genericSTM32F103C8",
                "c:/Temp/Platformio Projects/readermbed/src",
                "C:/PLATFO~1/packages/FRAMEW~3/cmsis",
                "C:/PLATFO~1/packages/FRAMEW~3/cmsis/TARGET~1",
                "C:/PLATFO~1/packages/FRAMEW~3/drivers",
                "C:/PLATFO~1/packages/FRAMEW~3/events",
                "C:/PLATFO~1/packages/FRAMEW~3/events/equeue",
                "C:/PLATFO~1/packages/FRAMEW~3/hal",
                "C:/PLATFO~1/packages/FRAMEW~3/hal/STORAG~1",
                "C:/PLATFO~1/packages/FRAMEW~3/platform",
                "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1",
                "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1/TA6EE1~1",
                "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1/TA6EE1~1/TARGET~3",
                "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1/TA6EE1~1/TARGET~3/device",
                "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1/TA6EE1~1/device",
                "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103",
                "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBAudio",
                "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBDevice",
                "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBHID",
                "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBMIDI",
                "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBMSD",
                "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBSerial",
                "C:/.platformio/packages/framework-mbed/features/unsupported/dsp",
                "c:/Temp/Platformio Projects/readermbed/features/unsupported/dsp",
                "C:/.platformio/packages/framework-mbed/features/unsupported/dsp/cmsis_dsp",
                "C:/.platformio/packages/framework-mbed/features/unsupported/dsp/dsp",
                "C:/.platformio/packages/framework-mbed/features/unsupported/rpc",
                "c:/Temp/Platformio Projects/readermbed/features/unsupported/rpc",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost",
                "c:/Temp/Platformio Projects/readermbed/features/unsupported/USBHost",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHost",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHost3GModule",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostHID",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostHub",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostMIDI",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostMSD",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostSerial",
                "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/targets/TARGET_STM",
                "C:/.platformio/packages/tool-unity",
                "c:/Temp/Platformio Projects/readermbed/include",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "${workspaceRoot}/.vscode/.browse.c_cpp.db",
                "path": [
                    "C:/.platformio/packages/framework-mbed",
                    "c:/Temp/Platformio Projects/readermbed/.pioenvs/genericSTM32F103C8",
                    "c:/Temp/Platformio Projects/readermbed/src",
                    "C:/PLATFO~1/packages/FRAMEW~3/cmsis",
                    "C:/PLATFO~1/packages/FRAMEW~3/cmsis/TARGET~1",
                    "C:/PLATFO~1/packages/FRAMEW~3/drivers",
                    "C:/PLATFO~1/packages/FRAMEW~3/events",
                    "C:/PLATFO~1/packages/FRAMEW~3/events/equeue",
                    "C:/PLATFO~1/packages/FRAMEW~3/hal",
                    "C:/PLATFO~1/packages/FRAMEW~3/hal/STORAG~1",
                    "C:/PLATFO~1/packages/FRAMEW~3/platform",
                    "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1",
                    "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1/TA6EE1~1",
                    "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1/TA6EE1~1/TARGET~3",
                    "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1/TA6EE1~1/TARGET~3/device",
                    "C:/PLATFO~1/packages/FRAMEW~3/targets/TAE5D3~1/TA6EE1~1/device",
                    "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103",
                    "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBAudio",
                    "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBDevice",
                    "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBHID",
                    "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBMIDI",
                    "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBMSD",
                    "c:/Temp/Platformio Projects/readermbed/.piolibdeps/USBDevice_STM32F103/USBSerial",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/dsp",
                    "c:/Temp/Platformio Projects/readermbed/features/unsupported/dsp",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/dsp/cmsis_dsp",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/dsp/dsp",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/rpc",
                    "c:/Temp/Platformio Projects/readermbed/features/unsupported/rpc",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost",
                    "c:/Temp/Platformio Projects/readermbed/features/unsupported/USBHost",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHost",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHost3GModule",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostHID",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostHub",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostMIDI",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostMSD",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/USBHostSerial",
                    "C:/.platformio/packages/framework-mbed/features/unsupported/USBHost/targets/TARGET_STM",
                    "C:/.platformio/packages/tool-unity",
                    "c:/Temp/Platformio Projects/readermbed/include",
                    ""
                ]
            },
            "defines": [
                "PLATFORMIO=30604",
                "STM32F103xB",
                "HSE_VALUE=12000000U",
                "ARM_MATH_CM3",
                "COMPONENT_NSPE=1",
                "COMPONENT_PSA_SRV_EMUL=1",
                "COMPONENT_PSA_SRV_IMPL=1",
                "DEVICE_ANALOGIN=1",
                "DEVICE_CAN=1",
                "DEVICE_FLASH=1",
                "DEVICE_I2C=1",
                "DEVICE_I2CSLAVE=1",
                "DEVICE_I2C_ASYNCH=1",
                "DEVICE_INTERRUPTIN=1",
                "DEVICE_PORTIN=1",
                "DEVICE_PORTINOUT=1",
                "DEVICE_PORTOUT=1",
                "DEVICE_PWMOUT=1",
                "DEVICE_RTC=1",
                "DEVICE_SERIAL=1",
                "DEVICE_SERIAL_ASYNCH=1",
                "DEVICE_SERIAL_FC=1",
                "DEVICE_SLEEP=1",
                "DEVICE_SPI=1",
                "DEVICE_SPISLAVE=1",
                "DEVICE_SPI_ASYNCH=1",
                "DEVICE_USTICKER=1",
                "TARGET_BLUEPILL_F103C8",
                "TARGET_CORTEX",
                "TARGET_CORTEX_M",
                "TARGET_FAMILY_STM32",
                "TARGET_LIKE_CORTEX_M3",
                "TARGET_LIKE_MBED",
                "TARGET_M3",
                "TARGET_RELEASE",
                "TARGET_STM",
                "TARGET_STM32F1",
                "TARGET_STM32F103C8",
                "TOOLCHAIN_GCC",
                "TOOLCHAIN_GCC_ARM",
                "TRANSACTION_QUEUE_SIZE_SPI=2",
                "__CMSIS_RTOS",
                "__CORTEX_M3",
                "__MBED_CMSIS_RTOS_CM",
                "__MBED__=1",
                ""
            ],
            "intelliSenseMode": "clang-x64",
            "cppStandard": "c++14",
            "compilerPath": "C:/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc.exe -mcpu=cortex-m3 -mthumb",
            "cStandard": "c11"
        }
    ],
    "version": 4
}

Setting the extension update channel (c_cpp.UpdateChannel) to insiders and updating the extension fixed the error for me.
Alternatively, rolling back to a previous version might help (but I didn’t test this).

Maybe this sheds some light on why 8.3 filenames are generated: The C/Cpp Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted · Issue #3104 · microsoft/vscode-cpptools · GitHub

I’m having this same problem and it’s maddening.

What do you mean by " Setting the extension update channel ( c_cpp.UpdateChannel ) to insiders and updating the extension"

How do you do this? I have no idea where C_cpp.UpdateChannel is located. Can you further detail how you did this? Thanks!

Open Visual Studio Code parameters and enter parameter name into search field.

Thank you so much for investigation. Yes, we use “8.3 filenames” because “Windows is the best OS in the world” :face_vomiting: It has CLI limitation. ARM mbed OS has a lot of includes.

Nevertheless, we have fixed this issue on our side. We return full path for VSCode now. Please update packages via $ pio update in IDE terminal or PIO Home > Platforms > Updates.

The problem is still occuring for me

Hi @ivankravets!

Yesterday I installed PlatformIO in virtual machine where it has never been installed before, and I still get this error!

VS Code 1.43.2, PlatformIO IDE 1.10.0, core 4.3.1.

Which error do you have?

The same as in the original message.

Please report issue to Issues · microsoft/vscode-cpptools · GitHub with all details. Looks like a problem with C++ extension.