muhammadsammy / free-vscode-csharp

Free/Libre fork of the official C# extension for vscode

Home Page:https://open-vsx.org/extension/muhammad-sammy/csharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Debugger Not Working

j0of opened this issue · comments

Hey there,
I recently migrated to VSCodium from VSCode for writing C# code, since IDEs like Rider and VS2022 are a bit too heavy for my machine (on their own, they work fine, but I like to multitask a lot while I code, which isn't really possible with a huge IDE taking 80% of my RAM).
The linting, intellisense, and everything else work fine, but debugging doesn't seem to be working.

Running a Hello World program doesn't give me any errors, but also doesn't greet the world.
image
I tested this with several other projects, including a simple game built with Monogame, but it didn't load a window either.

I have also tried changing the "console": field in .vscode/launch.json, but it didn't make any changes. Other than that, the launch.json file is pretty much untouched and fully generated by the "generate assets" popup that appears when I open a C# project, but here it is just in case:

{
    "version": "0.2.0",
    "configurations": [
        {
            // 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/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
            "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/net8.0/test.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach"
        }
    ]
}

The same issue.

Neither modern LSP nor old Omnisharp method work.

The latest .NET v7 release:

dpkg -al | grep dotnet
ii  dotnet-apphost-pack-7.0               7.0.14-1                                    amd64        Microsoft.NETCore.App.Host 7.0.14
ii  dotnet-host                           7.0.14-1                                    amd64        Microsoft .NET Host - 7.0.14
ii  dotnet-hostfxr-7.0                    7.0.14-1                                    amd64        Microsoft .NET Host FX Resolver - 7.0.14
ii  dotnet-runtime-7.0                    7.0.14-1                                    amd64        Microsoft.NETCore.App.Runtime 7.0.14
ii  dotnet-runtime-deps-7.0               7.0.14-1                                    amd64        dotnet-runtime-deps-debian 7.0.14
ii  dotnet-sdk-7.0                        7.0.404-1                                   amd64        Microsoft .NET SDK 7.0.404
ii  dotnet-targeting-pack-7.0             7.0.14-1                                    amd64        Microsoft.NETCore.App.Ref 7.0.14

VSCodium:

Version: 1.84.0
Release: 23306
Commit: 695a9146b1347633e608f9f166c81b5b2843b492
Date: 2023-11-02T15:23:23.641Z
Electron: 25.9.2
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 4.19.197-gnu

Trying OmniSharp:

Starting OmniSharp server at 12/7/2023, 12:36:44 PM
    Target: /download/dotnet/i

OmniSharp server started with .NET 7.0.404
 (/usr/share/dotnet).
    Path: /home/alex/.vscode-oss/extensions/muhammad-sammy.csharp-2.12.19-universal/.omnisharp/1.39.10-net6.0/OmniSharp.dll
    PID: 3654

Debugger is not activated on a breakpoint.

Trying Microsoft LSP (Dotnet › Server: Use Omnisharp: disabled):

Dotnet path: /usr/share/dotnet/dotnet
Activating C# standalone...
waiting for named pipe information from server...
[stdout] crit: Program[0]
      Server started with process ID 8113
crit: Program[0]
      Waiting 0:01:00 for a debugger to attach
[Error - 12:46:24 PM] Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server.
Error: Timeout. Named pipe information not received from server.
	at q.<anonymous> (/home/alex/.vscode-oss/extensions/muhammad-sammy.csharp-2.12.19-universal/dist/extension.js:2:1215440)
	at Generator.next (<anonymous>)
	at s (/home/alex/.vscode-oss/extensions/muhammad-sammy.csharp-2.12.19-universal/dist/extension.js:2:1205669)

Debugger still does not work. Is it possible to increase timeout for LSP connection?

Is there anything I can do? Or should I just use VSCode for now?

Is there anything I can do? Or should I just use VSCode for now?

Can you please indicate your versions of the software mentioned in my earlier message?

Did you try both old OmniSharp and modern Microsoft LSP?

VSCodium:

Version: 1.84.2
Release: 23319
Commit: 1fc52b725b3f76b97eadfd988cea42a739ae923f
Date: 2023-11-15T22:06:28.743Z
Electron: 25.9.2
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22631

Here is the output from dotnet --info:

.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.1eabc556

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100\

.NET workloads installed:
 Workload version: 8.0.100-manifests.1eabc556
There are no installed workloads to display.

Host:
  Version:      8.0.0
  Architecture: x64
  Commit:       5535e31a71

.NET SDKs installed:
  6.0.417 [C:\Program Files\dotnet\sdk]
  7.0.311 [C:\Program Files\dotnet\sdk]
  8.0.100-rc.2.23502.2 [C:\Program Files\dotnet\sdk]
  8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-rc.2.23480.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-rc.2.23479.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0-rc.2.23479.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

I am unsure about the last two. How do I get output from Omnisharp and in which menu can I find the options Dotnet > Server: Use omnisharp ?
Thanks!

in which menu can I find the options Dotnet > Server: Use omnisharp ?

In the setting of the C# addon.

Type following in the search: @ext:muhammad-sammy.csharp omnisharp

I can't reproduce this issue. The debugger seems to work properly.

I have literally the same issue. When launching the debugger, it builds the project and doesn't do anything afterwards. No errors

I can't reproduce this issue. The debugger seems to work properly.

May I please know your environment where you try to reproduce it?
I mean the OS and VSCodium versions you use like I mentioned mine above.

Are you interested to test this issue in a docker container image which can be connected to host Xorg via a unix socket (via docker volume) or ssh -X ?
Such image would have a Debian + .NET v7.latest + VSCodium, which would provide you almost identical environment where I test.

Here is my environment details:

OS

Debian sid

VSCodium

Version: 1.84.2
Release: 23319
Commit: 1fc52b725b3f76b97eadfd988cea42a739ae923f
Date: 2023-11-15T21:57:44.436Z
Electron: 25.9.2
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.5.0-gnu

DotNet

dpkg -al | grep dotnet
ii  dotnet-apphost-pack-3.1                                     3.1.32-1                                                     amd64        Microsoft.NETCore.App.Host 3.1.32
ii  dotnet-apphost-pack-5.0                                     5.0.17-1                                                     amd64        Microsoft.NETCore.App.Host 5.0.17
ii  dotnet-apphost-pack-6.0                                     6.0.25-1                                                     amd64        Microsoft.NETCore.App.Host 6.0.25
ii  dotnet-apphost-pack-7.0                                     7.0.14-1                                                     amd64        Microsoft.NETCore.App.Host 7.0.14
ii  dotnet-apphost-pack-8.0                                     8.0.0-1                                                      amd64        Microsoft.NETCore.App.Host 8.0.0
ii  dotnet-host                                                 8.0.0-1                                                      amd64        Microsoft .NET Host - 8.0.0
ii  dotnet-hostfxr-3.1                                          3.1.32-1                                                     amd64        Microsoft .NET Core Host FX Resolver - 3.1.32 3.1.32
ii  dotnet-hostfxr-5.0                                          5.0.17-1                                                     amd64        Microsoft .NET Host FX Resolver - 5.0.17 5.0.17
ii  dotnet-hostfxr-6.0                                          6.0.25-1                                                     amd64        Microsoft .NET Host FX Resolver - 6.0.25
ii  dotnet-hostfxr-7.0                                          7.0.14-1                                                     amd64        Microsoft .NET Host FX Resolver - 7.0.14
ii  dotnet-hostfxr-8.0                                          8.0.0-1                                                      amd64        Microsoft .NET Host FX Resolver - 8.0.0
ii  dotnet-runtime-3.1                                          3.1.32-1                                                     amd64        Microsoft .NET Core Runtime - 3.1.32 Microsoft.NETCore.App 3.1.32
ii  dotnet-runtime-5.0                                          5.0.17-1                                                     amd64        Microsoft .NET Runtime - 5.0.17 Microsoft.NETCore.App 5.0.17
ii  dotnet-runtime-6.0                                          6.0.25-1                                                     amd64        Microsoft.NETCore.App.Runtime 6.0.25
ii  dotnet-runtime-7.0                                          7.0.14-1                                                     amd64        Microsoft.NETCore.App.Runtime 7.0.14
ii  dotnet-runtime-8.0                                          8.0.0-1                                                      amd64        Microsoft.NETCore.App.Runtime 8.0.0
ii  dotnet-runtime-deps-3.1                                     3.1.32-1                                                     amd64        dotnet-runtime-deps-3.1 3.1.32
ii  dotnet-runtime-deps-5.0                                     5.0.17-1                                                     amd64        dotnet-runtime-deps-5.0 5.0.17
ii  dotnet-runtime-deps-6.0                                     6.0.25-1                                                     amd64        dotnet-runtime-deps-debian 6.0.25
ii  dotnet-runtime-deps-7.0                                     7.0.14-1                                                     amd64        dotnet-runtime-deps-debian 7.0.14
ii  dotnet-runtime-deps-8.0                                     8.0.0-1                                                      amd64        dotnet-runtime-deps-debian 8.0.0
ii  dotnet-sdk-3.1                                              3.1.426-1                                                    amd64        Microsoft .NET Core SDK 3.1.426
ii  dotnet-sdk-5.0                                              5.0.408-1                                                    amd64        Microsoft .NET SDK 5.0.408
ii  dotnet-sdk-6.0                                              6.0.417-1                                                    amd64        Microsoft .NET SDK 6.0.417
ii  dotnet-sdk-7.0                                              7.0.404-1                                                    amd64        Microsoft .NET SDK 7.0.404
ii  dotnet-sdk-8.0                                              8.0.100-1                                                    amd64        Microsoft .NET SDK 8.0.100
ii  dotnet-targeting-pack-3.1                                   3.1.0-1                                                      amd64        Microsoft.NETCore.App.Ref 3.1.0
ii  dotnet-targeting-pack-5.0                                   5.0.0-1                                                      amd64        Microsoft.NETCore.App.Ref 5.0.0
ii  dotnet-targeting-pack-6.0                                   6.0.25-1                                                     amd64        Microsoft.NETCore.App.Ref 6.0.25
ii  dotnet-targeting-pack-7.0                                   7.0.14-1                                                     amd64        Microsoft.NETCore.App.Ref 7.0.14
ii  dotnet-targeting-pack-8.0                                   8.0.0-1                                                      amd64        Microsoft.NETCore.App.Ref 8.0.0

Related extensions

muhammad-sammy.csharp v2.14.8
ms-dotnettools.vscode-dotnet-runtime v2.0.0

C# etension settings

  "omnisharp.enableDecompilationSupport": true,
  "omnisharp.enableEditorConfigSupport": true,
  "omnisharp.enableRoslynAnalyzers": true,
  "omnisharp.useEditorFormattingSettings": false,
  "omnisharp.useGlobalMono": "never",

Are you interested to test this issue in a docker container image which can be connected to host Xorg via a unix socket (via docker volume) or ssh -X ? Such image would have a Debian + .NET v7.latest + VSCodium, which would provide you almost identical environment where I test.

Sure 👍

The same issue:
Version: 0.20.2
VSCode Version: 1.84.2
Commit: 33c8b08492b48664cb00a8ab054f2d60697bbf90
Date: 2023-12-19T02:08:30.362Z
Electron: 25.9.2
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22631

Try manually changing the debugger path from .vscode-oss/extensions/muhammad-sammy.csharp-2.14.8-universal/.debugger/netcorebg/netcoredbg to .vscode-oss/extensions/muhammad-sammy.csharp-2.14.8-universal/.debugger/x86_64/netcorebg/netcoredbg

i.e. by putting the netcoredbg foder into a folder named after the platform architechture (x86_64 or arm64)

OR
Update to the latest extension version: v2.14.9

@JokerBoom @StegBrind @a-prokopyev-resume @j0of

it's working.
Thanks!

Closing this issue as it is resolved.
If the issue presists, please reopen.

I'm having a similar issue when running the "Hello Word" C# project. The Debugger buttons appear for a second then disappear. Then the terminal displays this:

*  Executing task: dotnet build /Users/jabarig/repos/the_ether/the_ether.csproj /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary;ForceNoAlign 

MSBuild version 17.9.6+a4ecab324 for .NET
 Determining projects to restore...
 All projects are up-to-date for restore.
 the_ether -> /Users/jabarig/repos/the_ether/bin/Debug/net8.0/the_ether.dll
*  Terminal will be reused by tasks, press any key to close it. 

It doesn't show the run output like the OPs issue. Both the Output & Debug Console display nothing. The Problems tab says there are no problems detected. I'm not sure how to change the path locations. I can change them in my OS of course but I'm not sure how to update that new path in the extension's settings.

VS Codium

Version: 1.88.0
Release: 24096
Commit: 0f99737786f756fe93e2a6e5d8146c46f4a53a4f
Date: 2024-04-05T12:32:16.317Z
Electron: 28.2.8
ElectronBuildId: undefined
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.2.0

VS Codium Settings:
"omnisharp.enableDecompilationSupport": true

% dotnet --info

.NET SDK:
Version:           8.0.203
Commit:            5e1ceea679
Workload version:  8.0.200-manifests.a7f084b6
Runtime Environment:
OS Name:     Mac OS X
OS Version:  14.2
OS Platform: Darwin
RID:         osx-arm64
Base Path:   /usr/local/share/dotnet/sdk/8.0.203/  
.NET workloads installed:
There are no installed workloads to display.
Host:
Version:      8.0.3
Architecture: arm64
Commit:       9f4b1f5d66
.NET SDKs installed:
8.0.203 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT       [/Users/jabarig/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download

@muhammadsammy