Debug session crashing - Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object
Type: Debugger Input information below
Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.
OS and Version: Ubuntu 18, 64bit VS Code Version: 1.30.1 C/C++ Extension Version: 0.20.1
- A clear and concise description of what the bug is.
After launching the debugger, the debug console shows this error message
Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object
This is my launch.json
{
"name": "(gdb) my-debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/myproj,
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}/myproj",
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/sgdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Have gdb ignore SIGUSR1",
"text": "handle SIGUSR1 nostop noprint",
"ignoreFailures": true
},
{
"description": "Have gdb ignore SIGUSR2",
"text": "handle SIGUSR2 nostop noprint",
"ignoreFailures": true
}
]
},
sgdb is simply a script which opens gdb using sudo.
Note : This only happens when "externalConsole" set to true. With it to set to false (using integrated terminal), there are no issues.
@pieandcakes : Not sure what changed from the last time i submitted an issue. This is the link for it
https://github.com/Microsoft/vscode-cpptools/issues/2753
I also see a similar issue logged for the insiders version (https://github.com/Microsoft/vscode-cpptools/issues/2858)
But it looks like the problem happens with the non-insiders version too.
Please update the cpptools extension to the latest insiders and let me know if you are still experiencing this issue.
@WardenGnaw : I havent used the insiders version before. Could you point me to the instructions on how to install the insiders version instead of the non-insiders version?
Also, once the fix is propagated to the non-insiders version, how do i switch back from the insiders version to the non-insiders version ?
I also see a similar issue logged for the insiders version (#2858) But it looks like the problem happens with the non-insiders version too.
@princehektor the issue was in VS Code and we made a fix that we haven't released yet. VS Code released an update that had the issue that they also then fixed, but it is in their insiders track.
You can fix the issue by either installing the insiders version of the extension or the insiders version of VS Code.
To install the insiders version of the extension, download the file that @WardenGnaw linked above and then uninstall the extension in your current version of VS Code and manually install the extension following these instructions.
@pieandcakes and @WardenGnaw : I can confirm that the latest insiders version works fine. So i will use this for now.
Will the fix be eventually propagated to the non-insiders version as well ?
In general, is it recommended to use the insiders or non-insiders version of the plugin ?
@princehektor Yes, the change will get propogated to our next non-insiders (hopefully next week).
I would recommend all users who are comfortable reporting issues on GitHub to use the Insiders versions unless there's something breaking with that -- i.e. our pending 0.20.1-insiders3 has 50 or so fixes. Using the C_Cpp.updateChannel "Insiders" is the easiest way.
I installed 0.20.1-insiders3, and now GDB starts :) But it crashes on a breakpoint: Stopping due to fatal error: NotImplementedException: No handler implemented for request type 'SourceRequest'!
After I changed the working directory it stopped crashing :-) ("cwd": "${workspaceRoot}/foo/bar",)
Maybe the error should be different, but it works now for me.
Duplicate of #2922