coder / code-server

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

Debugging .NET Core #473

Closed MakoPhil closed 4 years ago

MakoPhil commented 5 years ago

I spun this up and had a quick go, love the potential here. Could be just the justification I need for a powerful dev box sitting in a cupboard... ;)

One dealbreaker though, and I'm not sure this is something that can be resolved from this end is that the .NET debugger is not licensed for use with anything non-Microsoft. The following notification pops up when I try:

.NET Debugging is supported only in Microsoft versions of VS Code. See https://aka.ms/VSCode-DotNet-DbgLicense for more information.

Furthermore, I'm working with an Angular frontend, how would debugging work for that? Would a local browser tab directed at the server debug instance latch on to the IDE debugger?

Thanks and keep up the good work, I'm keen to see where this goes!

adrianliechti commented 5 years ago

ciao @MakoPhil

for the second, I can suggest you an idea:

see our Dockerfile for an idea of this: https://github.com/monostream/code-server/blob/develop/Dockerfile

and yes... I feel you because the .net core debug story - unsure if this project can do something without the support of microsoft. jetbrains had the same issue in rider - and worked around somehow: see here https://blog.jetbrains.com/dotnet/2017/06/16/rider-eap-23-net-core-debugger-back-code-cleanup/

MakoPhil commented 5 years ago

Thanks for the response, @adrianliechti! I did not know about that extension so thanks for introducing me to it. I'll keep an eye on this project, without .NET Core debugging it's not much use to me I'm afraid, but who knows, maybe Microsoft will take an interest down the line.

Alumniminium commented 5 years ago

Very disappointed with the lack of debugging on netcore. Can you work that out, like jetbains did?

meareindel commented 5 years ago

Jetbrains made their own .NET Core debugger, see comments here -https://blog.jetbrains.com/dotnet/2017/02/23/rider-eap-18-coreclr-debugging-back-windows/

Perhaps they could elaborate on this.

liguobao commented 5 years ago

Microsoft limit it? So bad.

liguobao commented 5 years ago

What does this error mean? The C# extension for Visual Studio Code includes the Microsoft .NET Core Debugger (vsdbg). Unlike VS Code, and most other parts of the .NET Core Ecosystem, vsdbg is not an open source product but rather is a proprietary part of Visual Studio. It is licensed to work only with IDEs from Microsoft -- Visual Studio Code, Visual Studio, or Visual Studio for Mac. Visual Studio Code has an official version distributed by Microsoft but it is also an open source project, so anyone can build and distribute their own version. The C# extension itself along with the C# and Razor language services will work correctly with a VS Code distribution based on the OSS project. However, the debugger is only licensed to work with the Microsoft-distributed version of Visual Studio Code.

https://github.com/OmniSharp/omnisharp-vscode/wiki/Microsoft-.NET-Core-Debugger-licensing-and-Microsoft-Visual-Studio-Code

wowaz commented 5 years ago

I'm using https://github.com/Samsung/netcoredbg Here's a little exmaple on how to use it. https://github.com/VSCodium/vscodium/issues/82#issue-409806641

sr229 commented 5 years ago

I don't think we can support this. I do suggest @wowaz's solution though.

Alumniminium commented 5 years ago

Vscode natively supports this now (incl. debugging) https://code.visualstudio.com/docs/remote/remote-overview

sr229 commented 5 years ago

Vscode natively supports this now (incl. debugging) https://code.visualstudio.com/docs/remote/remote-overview

We only have their changes in GH-857 though, its not yet merged in mainline @Alumniminium

sr229 commented 5 years ago

@MakoPhil oh btw before I forget, try out the v2 branch to see if .NET Core works.

Alumniminium commented 5 years ago

Vscode natively supports this now (incl. debugging) https://code.visualstudio.com/docs/remote/remote-overview

We only have their changes in GH-857 though, its not yet merged in mainline @Alumniminium

I don't even get how this project is different from VSC Remote... I just replaced code-server with it and it works the same from what I can tell.

sr229 commented 5 years ago

@Alumniminium VSC Remote isn't open source from what I can tell, but we do use the new VSCode Web variation which is totally different from VSC Remote (it does use VSCR internals but we serve a entire cloud IDE).

adrianliechti commented 5 years ago

I tested this Samsung Debugger and it works - but sadly the C# extension does not let you define this pipeTransport as it's default.

If you have a look at the docker file: https://github.com/monostream/code-server/blob/develop/Dockerfile

# Setup the Environment for .NET
ENV DOTNET_CLI_TELEMETRY_OPTOUT "true"
ENV MSBuildSDKsPath "/usr/share/dotnet/sdk/2.2.402/Sdks"
ENV PATH "${PATH}:${MSBuildSDKsPath}"

# Setup .NET Core Extension
RUN mkdir -p ${VSCODE_EXTENSIONS}/csharp \
    && curl -JLs https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-vscode/vsextensions/csharp/latest/vspackage | bsdtar --strip-components=1 -xf - -C ${VSCODE_EXTENSIONS}/csharp extension

# Download the Samsung Debugger
RUN curl -sL https://github.com/Samsung/netcoredbg/releases/download/latest/netcoredbg-linux-master.tar.gz | tar -zx -C /home/coder
ENV PATH "${PATH}:/home/coder/netcoredbg"

In launch options of a c# project, set the pipetransport to use this debugger.

{
   // Use IntelliSense to find out which attributes exist for C# debugging
   // Use hover for the description of the existing attributes
   // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
   "version": "0.2.0",
   "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/project.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
            "console": "internalConsole",
            "stopAtEntry": false,
            "pipeTransport": {
                "pipeProgram": "bash",
                "pipeArgs": [
                    "-c"
                ],
                "debuggerPath": "/home/coder/netcoredbg/netcoredbg",
                "quoteArgs": true
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}
sr229 commented 5 years ago

I tested this Samsung Debugger and it works - but sadly the C# extension does not let you define this pipeTransport as it's default.

If you have a look at the docker file: https://github.com/monostream/code-server/blob/develop/Dockerfile

# Setup the Environment for .NET
ENV DOTNET_CLI_TELEMETRY_OPTOUT "true"
ENV MSBuildSDKsPath "/usr/share/dotnet/sdk/2.2.402/Sdks"
ENV PATH "${PATH}:${MSBuildSDKsPath}"

# Setup .NET Core Extension
RUN mkdir -p ${VSCODE_EXTENSIONS}/csharp \
    && curl -JLs https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-vscode/vsextensions/csharp/latest/vspackage | bsdtar --strip-components=1 -xf - -C ${VSCODE_EXTENSIONS}/csharp extension

# Download the Samsung Debugger
RUN curl -sL https://github.com/Samsung/netcoredbg/releases/download/latest/netcoredbg-linux-master.tar.gz | tar -zx -C /home/coder
ENV PATH "${PATH}:/home/coder/netcoredbg"

In launch options of a c# project, set the pipetransport to use this debugger.

{
   // Use IntelliSense to find out which attributes exist for C# debugging
   // Use hover for the description of the existing attributes
   // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
   "version": "0.2.0",
   "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/project.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
            "console": "internalConsole",
            "stopAtEntry": false,
            "pipeTransport": {
                "pipeProgram": "bash",
                "pipeArgs": [
                    "-c"
                ],
                "debuggerPath": "/home/coder/netcoredbg/netcoredbg",
                "quoteArgs": true
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}

Really interesting workaround. We'll try to fix this on our end so its easier to work with C# people. I know a lot of C# developers would like to use code-server for this.

Rakiah commented 5 years ago

any one manages to make samsung .NET Core debugger with dockerized environment ? I cannot make it work, if anyone has a config file that work out I would be very grateful

https://github.com/Samsung/netcoredbg/issues/24

nhooyr commented 4 years ago

Regarding the original issue, we can't use the .NET debugger due to licensing issues.