Home > OS >  VSCode c debugging unhandled exception
VSCode c debugging unhandled exception

Time:05-31

When I try to debug my c program in vscode it gives me error stating that "windowsdebuglauncher.exe has stopped working" following this message in console:

Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.FormattableStringFactory' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at WindowsDebugLauncher.Program.ParseDebugExeArgs(String line)
   at WindowsDebugLauncher.Program.Main(String[] argv)

When try to debug I run default configurations automatically created by vscode (so basically my launch.json is almost empty and tasks.json default). Compiler: gcc, Debugger: gdb. I assume this issue comes because something is not installed on my OS(Windows 8.1). What may cause this thing and how to fix it?

UPD: My tasks.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C  : gcc.exe build active file",
            "command": "C:\\msys64\\mingw64\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "sprintf.c",
                "s21_string.c",
                "s21_string_io.c",
                "s21_string_special.c",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-lcheck"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

My launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": 
    [ 
        // {
        //     "name": "default",
        //     "type": "cppvsdbg",
        //     "request": "launch",
        //     "program": "src\\test.exe",
        //     "args": [],
        //     "stopAtEntry": true,
        //     "environment": [],
        //     "console": "externalTerminal",
        //     "cwd": "${workspaceFolder}",
        //     "preLaunchTask": "C/C  : gcc.exe build active file"
        // }
    ]
}

If i uncomment these lines, it will successfully build file but debug will not be launched and no error message appears and debug console will be empty.

CodePudding user response:

I do not know how, but i fixed the issue. Despair of finding debugger I ran gdb manually in vscode terminal and then ran it through vscode and it seem to work.

  • Related