Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug.Writeline Exits Console App #171

Open
YogiCoder8888 opened this issue Jun 4, 2024 · 4 comments
Open

Debug.Writeline Exits Console App #171

YogiCoder8888 opened this issue Jun 4, 2024 · 4 comments

Comments

@YogiCoder8888
Copy link

I have a .Net 8 Console App and when the debugger executes Debug.Writeline("...") the App exits with no errors or exception thrown. I am using VS Codium on Windows 11.

To reproduce the problem create a Console App with:

dotnet new console

The code in Program.cs is simple:

using System.Diagnostics;

Debug.WriteLine("Debug World"); // App exits here
Console.WriteLine("Hello, World!");

Launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/bin/Debug/net8.0/Console7.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach"
        }
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/Console7.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary;ForceNoAlign"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "publish",
            "command": "dotnet",
            "type": "process",
            "args": [
                "publish",
                "${workspaceFolder}/Console7.csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary;ForceNoAlign"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "watch",
            "command": "dotnet",
            "type": "process",
            "args": [
                "watch",
                "run",
                "--project",
                "${workspaceFolder}/Console7.csproj"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}

Any help or pointers will be appreciated. Thank you!

@viewizard
Copy link
Member

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/bin/Debug/net8.0/Console7.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach"
        }
    ]
}

Is not this mean you start MS debugger instead of netcoredbg? Could you please explain, how you configure to start netcoredbg binary?

Note, netcoredbg don't really have adapter for VSCode or VSCodium, we use dirty hack in order to launch debug session with adapter for MS debugger (MS C# extention) by override pipe and debugger binary. Not really sure it works with "request": "attach" at all (was not able do this).

@YogiCoder8888
Copy link
Author

No, I am not using MS Debugger - it is not available or supported in VS Codium.

I am using this VS Codium extension:

https://github.com/muhammadsammy/free-vscode-csharp

Underlying it's uses netcoredbg

@KhorAMus
Copy link

Year. I have the same problem. I am using an extension https://github.com/muhammadsammy/free-vscode-csharp

@gbalykov
Copy link
Member

Please try with "request": "launch"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants