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

Problem with debugging simple .Net mvc application #39

Closed
svor opened this issue Mar 26, 2020 · 16 comments
Closed

Problem with debugging simple .Net mvc application #39

svor opened this issue Mar 26, 2020 · 16 comments

Comments

@svor
Copy link

svor commented Mar 26, 2020

I'm trying to debug simple .Net mvc application which was generated by the command:
dotnet new mvc --no-https --auth None

When I run debug configuration in VS Code, it starts running the application and stops at entry but it freezes at

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();
        }

As a result the application doesn't start fully and the debugger is frozen. Any idea what is wrong?

Netcoredbg Log file
https://gist.github.com/svor/13af827c7d00b2577aeb7038a70a6412

VS Code debug configuration

{
    "version": "0.2.0",
    "configurations": [
    
        {
             "name": ".NET Core Launch (console)",
             "type": "coreclr",
             "request": "launch",
             "program": "/home/vsvydenko/tmp/net-core-mvc/bin/Debug/netcoreapp3.0/net-core-mvc.dll",
             "args": [],
             "cwd": "${workspaceFolder}",
             "console": "internalConsole",
             "stopAtEntry": true,
             "internalConsoleOptions": "openOnSessionStart",
 
             "pipeTransport": {
                 "pipeCwd": "${workspaceFolder}",
                 "pipeProgram": "bash",
                 "pipeArgs": ["-c"],
                 "debuggerPath": "/home/vsvydenko/bin/netcoredbg/netcoredbg  --engineLogging=/tmp/a",
                 "quoteArgs": true
             }
         },
     ]
 }

Short video
https://youtu.be/beBx9X_bh6g

Environment
os: Linux Mint 19.3 (x86-64)
dotnetcore-sdk: 3.0.1
netcoredbg: latest releas

@a-zh
Copy link

a-zh commented Mar 30, 2020

@svor Thanks a lot. I cannot reproduce the issue. I checked on Ubuntu 18.04. And I didn't see any problems. In video I saw the pause of debugger, but debugger wait of process (browser) running.
Can you check syslog?

  1. Please, add to launch.json this options and give me the log:
        "logging": {
                "engineLogging": true
            },

Should be in launch.json:

{
    "version": "0.2.0",
    "configurations": [
    
        {
             "name": ".NET Core Launch (console)",
             "type": "coreclr",
             "request": "launch",
             "program": "/home/vsvydenko/tmp/net-core-mvc/bin/Debug/netcoreapp3.0/net-core-mvc.dll",
             "args": [],
             "cwd": "${workspaceFolder}",
             "console": "internalConsole",
             "stopAtEntry": true,
             "internalConsoleOptions": "openOnSessionStart",
             "logging": {
                 "engineLogging": true
             },
             "pipeTransport": {
                 "pipeCwd": "${workspaceFolder}",
                 "pipeProgram": "bash",
                 "pipeArgs": ["-c"],
                 "debuggerPath": "/home/vsvydenko/bin/netcoredbg/netcoredbg  --engineLogging=/tmp/a",
                 "quoteArgs": true
             }
         },
     ]
 }
  1. Also, please check with netcoreapp2.2 instead netcoreapp3.0

  2. And, please check without "pipeTransport":
    Should be in launch.json:

{
    "version": "0.2.0",
    "configurations": [
    
        {
             "name": ".NET Core Launch (console)",
             "type": "coreclr",
             "request": "launch",
             "program": "/home/vsvydenko/tmp/net-core-mvc/bin/Debug/netcoreapp3.0/net-core-mvc.dll",
             "args": [],
             "cwd": "${workspaceFolder}",
             "console": "internalConsole",
             "stopAtEntry": true,
             "internalConsoleOptions": "openOnSessionStart",
             "logging": {
                 "engineLogging": true
             }
         },
     ]
 }

@joern-h
Copy link

joern-h commented Mar 30, 2020

Hi, i have the exact same issue with my mvc angular app:

Log: https://paste.linux.pizza/?e11e540467739a4f#9yp7wM8d7BaWKHNJAvyuZzrNawWx7vGmMxRZia9rApfS

lauch.json

{
    "name": ".NET Core Launch (web) [netcoredbg]",
    "type": "coreclr",
    "request": "launch",
    "preLaunchTask": "build",
    "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/MusicManager.dll",
    "args": [],
    "cwd": "${workspaceFolder}",
    "stopAtEntry": false,
    "logging": {
        "engineLogging": true
    },
    "serverReadyAction": {
        "action": "openExternally",
        "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
    },
    "env": {
        "ASPNETCORE_ENVIRONMENT": "Development"
    },
    "sourceFileMap": {
        "/Views": "${workspaceFolder}/Views"
    },
    "pipeTransport": {
        "pipeCwd": "${workspaceFolder}",
        "pipeProgram": "bash",
        "pipeArgs": ["-c"],
        "debuggerPath": "/usr/bin/netcoredbg --engineLogging=/tmp/a",
        "quoteArgs": true
    }
}

Log without "pipeTransport":
https://paste.linux.pizza/?bad818c7fa0d9d88#4cTgpoNkqEmR6a6cdYCQLwqps4RUNWNkg9DviDJehkJ8

@svor
Copy link
Author

svor commented Mar 31, 2020

Hello @a-zh, thank you for the answer.
It doesn't look like the debugger waits of browser running, i tried to open browser - the result was the same.

The file with logs was attached in the description, here it is:
https://gist.github.com/svor/13af827c7d00b2577aeb7038a70a6412

I cannot skip pipeTransport because there is only way I know to use netcoredbg in VS Code

@a-zh
Copy link

a-zh commented Mar 31, 2020

For this case:

The file with logs was attached in the description, here it is:
https://gist.github.com/svor/13af827c7d00b2577aeb7038a70a6412

  1. Does vsdbg debugger freezes too or not?
  2. Does the WEB browser work or not?

@a-zh
Copy link

a-zh commented Mar 31, 2020

@svor @joern-h Please, try this project with netcoreapp2.2 and netcoredbg.

project.tar.gz

@joern-h
Copy link

joern-h commented Mar 31, 2020

@a-zh
I tried with your project with netcoreapp2.2 and netcoredbg and the debugger freezes again.

It does not freeze with vsdbg and the browser opens.

But with netcoredbg it freezes and no browser opens...

Log: https://paste.linux.pizza/?f657698128316c64#BD2onk17hNVyeLs8BcitjzUCaG2haxsBdJ6738vkUFTu

It freezes after: services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
Startup.cs line 34

@svor
Copy link
Author

svor commented Mar 31, 2020

@a-zh @joern-h
the same result is on my side: netcoredbg freezes and the browser doesn't open

dotnet --version
2.2.402

Log file is here: https://gist.github.com/svor/a5a78db4e61cd779a97d1d59e013a880

@a-zh
Copy link

a-zh commented Mar 31, 2020

@joern-h @svor

I reproduced it once.
Netcoredbg has a problem with starting process at the first run.
I will investigate it.

But now, you can check netcoredbg with second and following runs.
Please, kill all of the dotnet and netcoredbg process:

ps auxww|grep dotnet
ps auxww|grep netcoredbg
kill -9 <pids>

Please, clean and rebuild the project.
Run debug, press F5 a few time before freezing and press Stop button.
Run debug again and tell me please result about running web browser.

@svor
Copy link
Author

svor commented Mar 31, 2020

@a-zh
The way which you described works. By pressing a few times F5 (which means continue in debug mode) the page opens in the browser.

@joern-h
Copy link

joern-h commented Apr 15, 2020

Sadly, pressing F5 a few times does not work on my angular app...

The server starts, but something is still wrong:
https://paste.linux.pizza/?95d95581799089ea#BnMxNa3Sj1tLyAxVVsnodSKiDRhwHmq3qhwzNMzXffDp

@a-zh
Copy link

a-zh commented Apr 22, 2020

@joern-h

Sadly, pressing F5 a few times does not work on my angular app...

@svor I found the issue with threads command. Fixes on review. And I see, that the webserver starts and webpage available from web-browser. Auto starting of webbrowser not supported right now.

The server starts, but something is still wrong:
https://paste.linux.pizza/?95d95581799089ea#BnMxNa3Sj1tLyAxVVsnodSKiDRhwHmq3qhwzNMzXffDp

Its looks like another issue. Please, give me more info of your project. I need full project sources for reproduce issue or dotnet command for generation the same project.

@joern-h
Copy link

joern-h commented Apr 22, 2020

@a-zh you can reproduce it by creating a new dotnet angular project:

dotnet new angular -o angular

and here is the launch.json

https://paste.linux.pizza/?13c14126dc33921d#6iAttBdu1kHAq9qyhYsugqavyd4KExqs7XWJh5yVweyE

dotnet --version 3.1.201

@viewizard
Copy link
Member

@joern-h @svor netcoredbg sources was updated with changes, that should fix this issue. Could you please check it?

@ppa93
Copy link

ppa93 commented Aug 9, 2020

@viewizard
Unfortunately, netcoredbg is still frozen, when try to debug MVC app.

@mitoriko
Copy link

I found use AddMvcCore() instead of AddMvc() ,netcoredbg will run well, but I don't know why...

@viewizard
Copy link
Member

I tested with application created by dotnet new mvc --no-https --auth None with .NET SDK 3.1, don't see any issues with current debugger release. Please reopen in case you still have this issue.
Screenshot 2023-04-21 220911

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

6 participants