muhammadsammy / free-vscode-csharp

Free/Libre fork of the official C# extension for vscode
https://open-vsx.org/extension/muhammad-sammy/csharp
Other
147 stars 17 forks source link

v2.0: "undefined" is not valid json in #60

Open Dreamoochy opened 1 year ago

Dreamoochy commented 1 year ago

VSCodium 1.82.1 with free-omnisharp 2.0.436. When I try to debug (F5) I get the following notification:

"undefined" is not valid JSON

Debug is not started. With free-omnisharp 1.25.7 everything is OK.

P.S. Portable VSCodium, portable .NET SDK (7.0.400)

Gzushgshsh commented 1 year ago

I had the same problem with VSCodium and dotnet 6.0 installed via the package manager on Debian. But it didn't recognize dotnet 6.0 and downloaded a portable version of 7.0 to use.

Rebjai commented 1 year ago

Having the same issue with code - OSS on Manjaro, .NET SDK 7.0.111 Help > Toggle Developer tools: image

yelvert commented 1 year ago

A workaround for this seems to be adding "csharp.debug": {}, to your settings

mars-low commented 1 year ago

A workaround from @yelvert didn't work for me unfortunately, at least not with the recent 2.7.25 and 2.0.436 versions.

However I found a reason why it fails and a temporary solution until the proper fix is merged.

Extension starts a debugger using the command defined here: https://github.com/muhammadsammy/free-omnisharp-vscode/blob/master/src/coreclrDebug/activate.ts#L286-L291

So on Linux system it ends up with the command looking like: ~/code-server/Extensions/muhammad-sammy.csharp-2.7.25-universal/.debugger/netcoredbg while netcoredbg is installed to the path ~/code-server/Extensions/muhammad-sammy.csharp-2.7.25-universal/.debugger/netcoredbg/netcoredbg. So the workaround is to move all files from netcoredbg directory one level up directly to .debugger directory.

It looks like the installation path is taken from installTestPath defined in https://github.com/muhammadsammy/free-omnisharp-vscode/blob/master/package.json#L489-L505. I think the proper fix could just modify the command path mentioned above to that value.

danyhoron commented 1 year ago

Thank you @mars-low. That workaround works.

muhammadsammy commented 1 year ago

Added this workaround in v2.8.23. Thanks @mars-low!

Dreamoochy commented 1 year ago

Added this workaround in v2.8.23.

v2.8.23 on Win10 now looks like it does nothing. When I press F5, build process is started, and then nothing happens. It doesn't stop at breakpoints. And I don't see any error notification.