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

Cannot debug a C# application #1526

Open
bhkeys opened this issue May 30, 2017 · 15 comments
Open

Cannot debug a C# application #1526

bhkeys opened this issue May 30, 2017 · 15 comments

Comments

@bhkeys
Copy link

bhkeys commented May 30, 2017

I am unable to debug a C# application, I am moving the issue to this repo as instructed by our friends at Microsoft

microsoft/vscode#27091 (comment)

@bernardbr
Copy link

I'm not sure, but I don't know if a project with project.json works with netcore 1.1

Could you try to debug this simple app?

@bhkeys
Copy link
Author

bhkeys commented May 30, 2017

I get these errors upon build

build error

Okay, so then I click to show problems, then I get this (I will also report this on the other repo)

no problems

So I go through the first step again and instead press "Debug Anyway", and I get the same error in the previous issue, the debugger detaches for some reason.

@bernardbr
Copy link

Did you do dotnet restore before trying to debug?

@bhkeys
Copy link
Author

bhkeys commented May 30, 2017

I just ran those and it said
warn : The folder '/home/bkeys/Devel/hello-world-netcore/src/consoleApp' does not contain a project to restore.

I did it in the project root as well

warn : The folder '/home/bkeys/Devel/hello-world-netcore/' does not contain a project to restore.

@bernardbr
Copy link

Could you give me your dotnet --info?

@bhkeys
Copy link
Author

bhkeys commented May 30, 2017

[bkeys@localhost hello-world-netcore]$ dotnet --info
.NET Command Line Tools (1.0.0-preview2-1-003175)

Product Information:
 Version:            1.0.0-preview2-1-003175
 Commit SHA-1 hash:  bb053ed000

Runtime Environment:
 OS Name:     fedora
 OS Version:  25
 OS Platform: Linux
 RID:         fedora.25-x64

@bernardbr
Copy link

I'll try to reproduce this in my VM...

@gregg-miskelly
Copy link
Contributor

A few notes in case any of this is helpful:

  • Fedora 25 is not officially supported by .NET Core. I believe it will be officially supported for 2.0. As such, I don't know how successful you will be assuming you are trying to do .NET Core development (as opposed to Unity or some other C# scenario).
  • You can look at your tasks.json to see the exact command line being executed and try running that at a terminal.
  • If you are using .csproj projects, you should upgrade your build of the .NET SDK

@bernardbr
Copy link

bernardbr commented May 30, 2017

Could you try to update your netcore?
As @gregg-miskelly said, Fedora 25 is not officially supported by .Net Core. I tried run in Fedora 24 and worked fine.

If you decide to upgrade your netcore version, you'll need to see these topics:

@bhkeys
Copy link
Author

bhkeys commented May 30, 2017

The dotnet Special Interest Group in Fedora does not have a more up to date binary to provide for Fedora for the time being, I will update it when a newer version is available. But shouldn't my old version still be able to run the consoleapp?
I have another hello world that can run, one of the issues appears to be when I run

dotnet run

I get this error

The current project is not valid because of the following errors:
/home/bkeys/Devel/hello-world-netcore/src/consoleApp(1,0): error DOTNET1017: Project file does not exist '/home/bkeys/Devel/hello-world-netcore/src/consoleApp/project.json'.

If I remember correctly .NET core uses project.json for linux and .csproj for windows; and this project uses .csproj

I have another project I created with dotnet that works just fine. But I am doing it from the command line when I run it.

@gregg-miskelly
Copy link
Contributor

No, project.json was the project file format for all projects from the start of the project through tooling v1.0 preview2. After tooling v1.0 preview2, the tooling switched to .csproj on all OSs. Project.json is deprecated now, and the version you have is the last release version that will ever be released that targets it.

Do you have a project.json in the path sited?

Technically you are running into a problem with the .NET CLI rather than this extension. But since you are using the deprecated tooling there isn't really a place for your bug.

@bernardbr
Copy link

bernardbr commented May 30, 2017

@bhkeys it works because you have the 1.0 preview version installed.
In version 1.0 Microsoft uses a project.json for all project types on all platforms, but after version 1.1 they bring back the .csproj with a new and simpler structure.

You can see more in:

@bhkeys
Copy link
Author

bhkeys commented May 30, 2017

Alright, thank you guys for the information. I will keep up with the dotnet SIG and will check to see if this works on a newer version of .NET once it gets released

@zeihanaulia
Copy link

i have same issue, but with macos. The debugger not doing anything.

This is my configuratiin

dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   2.2.104
 Commit:    73f036d4ac

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.2.104/

Host (useful for support):
  Version: 2.2.2
  Commit:  a4fd7b2c84

.NET Core SDKs installed:
  2.2.104 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
launch.json

{
   // 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 (web)",
            "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/tutorial.dll",
            "args": [
                "start"
            ],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart",
            "launchBrowser": {
                "enabled": true,
                "args": "${auto-detect-url}",
                "windows": {
                    "command": "cmd.exe",
                    "args": "/C start ${auto-detect-url}"
                },
                "osx": {
                    "command": "open"
                },
                "linux": {
                    "command": "xdg-open"
                }
            },
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            },
            "sourceFileMap": {
                "/Views": "${workspaceFolder}/Views"
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ,]
}

task.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/tutorial.csproj"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}

i got no error, debugger just running but, not doing anything.

@gregg-miskelly
Copy link
Contributor

@zeihanaulia if you would like help, please open a new issue, and include logs (instructions for enabling logging). Thanks!

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

No branches or pull requests

6 participants