vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

NullReferenceException on Linux when trying to debug

Open dunderX opened this issue 7 years ago • 4 comments

  • OS and Version: Linux Manjaro
  • VS Code Version: 1.34.0
  • C/C++ Extension Version: 0.23.1
  • Other extensions you installed (and if the issue persists after disabling them): none
  • A clear and concise description of what the bug is: got "Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object" on CONSOLE DEBUG. just tried to debug a simple c++ program to see how it works on vscode

launch.json:

    "name": "(gdb) Launch",
    "type": "cppdbg",
    "request": "launch",
    "program": "{workspaceFolder}/${fileBasenameNoExtension}",
    "args": [],
    "stopAtEntry": true,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": false,
    "MIMode": "gdb",
    "miDebuggerPath": "/usr/bin/gdb",

with a simplle "hello world" program

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.

when I tried to add these, I got "Property X is not allowed." on all of them..

dunderX avatar May 26 '19 13:05 dunderX

@dunderX can you paste a launch.json that has the logging that fails? I can't duplicate your error. Note you need to have the outer logging object and then specify the individual logging types within it: "logging": { "engineLogging": true } for example to enable engine logging.

pieandcakes avatar May 28 '19 17:05 pieandcakes

@dunderX can you paste a launch.json that has the logging that fails? I can't duplicate your error. Note you need to have the outer logging object and then specify the individual logging types within it: "logging": { "engineLogging": true } for example to enable engine logging.

I did it, but also changed "program" to the full path instead of "${fileDirname}/${fileBasenameNoExtension}". Now it's started. I guess this "${fileDirname}/${fileBasenameNoExtension}" doesn't point to the right executable file. Is there any way I can check what those values are and how to make sure they are set automatically for the next times?

thanks

dunderX avatar May 28 '19 18:05 dunderX

Those are resolved by VS Code and unfortunately without enabling a setting like traceResponse logging, where you can see what we are sent, there doesn't seem to be a good way to see the values.

pieandcakes avatar May 28 '19 18:05 pieandcakes

thanks, I'll figure it out.

dunderX avatar May 28 '19 18:05 dunderX