coder / code-server

VS Code in the browser
https://coder.com
MIT License
67.65k stars 5.55k forks source link

Not Able to run C# code #1942

Closed SaiTeja390 closed 4 years ago

SaiTeja390 commented 4 years ago

I'm trying to run code-sever on google cloud shell and working on C#. I'm not able to run any C# program. The DEBUG CONSOLE says

-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Code - OSS","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en","supportsProgressReporting":true},"type":"request","seq":1}

-> (C) {"command":"launch","arguments":{"name":".NET Core Launch (console)","type":"coreclr","request":"launch","preLaunchTask":"build","program":"/home/tejasai390/C_SHARP/new_project/console-app/bin/Debug/netcoreapp3.1/console-app.dll","args":[],"cwd":"/home/tejasai390/C_SHARP/new_project/console-app","console":"internalConsole","stopAtEntry":false,"logging":{"engineLogging":false},"internalConsoleOptions":"openOnSessionStart","__sessionId":"0eed73ab-aabc-484a-848a-3161658ba73e"},"type":"request","seq":2}

<- (E) {"seq":3,"type":"event","event":"output","body":{"category":"console","output":"-------------------------------------------------------------------\nYou may only use the Microsoft .NET Core Debugger (vsdbg) with\nVisual Studio Code, Visual Studio or Visual Studio for Mac software\nto help you develop and test your applications.\n-------------------------------------------------------------------\n"}}

------------------------------------------------------------------- You may only use the Microsoft .NET Core Debugger (vsdbg) with Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you develop and test your applications. -------------------------------------------------------------------

<- (R) {"seq":4,"type":"response","request_seq":2,"success":true,"command":"launch"} <- (E) {"seq":5,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/CommandFailed","data":{"VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr","VS.Diagnostics.Debugger.vsdbg.ErrorCode":-1989017584,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"debian","VS.Diagnostics.Debugger.vsdbg.Command":"handshake","VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"10","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.6.20415.1 commit:0184bb70e1ed40656c0dfa53125805036207007b"}}} <- (R) {"seq":6,"type":"response","request_seq":1,"success":false,"command":"handshake","message":"Error processing 'handshake' request. Unknown Error: 0x89720010"}

One if the above lines says "category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/CommandFailed"

Here is the output of dotnet --info tejasai390@cloudshell:~$ dotnet --info .NET Core SDK (reflecting any global.json): Version: 3.1.302 Commit: 41faccf259 Runtime Environment: OS Name: debian OS Version: 10 OS Platform: Linux RID: debian.10-x64 Base Path: /usr/share/dotnet/sdk/3.1.302/ Host (useful for support): Version: 3.1.6 Commit: 3acd9b0cd1 .NET Core SDKs installed: 2.1.808 [/usr/share/dotnet/sdk] 3.1.302 [/usr/share/dotnet/sdk] .NET Core runtimes installed: dotnet --info Microsoft.AspNetCore.All 2.1.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Following are some of the specs of my working environment:

I had checked Differences compared to VS Code. But the extensions are working well. So I do not understand what can be done.

When I googled a bit on this I read https://github.com/OmniSharp/omnisharp-vscode/issues/3775#issuecomment-627444859 and checked https://github.com/OmniSharp/omnisharp-vscode/wiki/Microsoft-.NET-Core-Debugger-licensing-and-Microsoft-Visual-Studio-Code. It says that we have to uninstall the existing VS Code and install the fresh new VS Code from Microsoft. But that will not let me use code-sever or rather I do not know as to how I can combine Microsoft's VS Code with code-server. Is it that I have to install a different extension for working with C# in code-server? Can someone please help how to sort out this issue?

code-asher commented 4 years ago

Yeah vsdbg is proprietary and isn't licensed to run in code-server. I think you can use netcoredbg although I haven't experimented with it personally. VSCodium has some info on it that will also apply to code-server: https://github.com/VSCodium/vscodium/blob/d6952163171b10fc63ce2e6cd5806b5a0cd40bab/DOCS.md#proprietary-debugging-tools

SaiTeja390 commented 4 years ago

Thanks code-asher. The above link helped me to solve the issue.

One point I would like to add is that I faced a huge problem installing clang since google cloud shell doesn't provide it by default. So I used this code to install clang-9. Then I cloned netcoredbg and used the following code to install the debugger:

cd netcoredbg/ mkdir build cd build CC=clang-9 CXX=clang++-9 cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../bin -DCORECLR_DIR=$PWD/../.coreclr DDOTNET_DIR=$PWD/../.dotnet cmake --build . --target install

Then changed the launch.json file as mentioned here.