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

Visual Studio 2022 and Docker project debugging issues #396

Open
rh101 opened this issue Aug 11, 2023 · 6 comments
Open

Visual Studio 2022 and Docker project debugging issues #396

rh101 opened this issue Aug 11, 2023 · 6 comments
Assignees

Comments

@rh101
Copy link

rh101 commented Aug 11, 2023

Something broke as a result of either a Visual Studio update, a Docker Desktop update, or something I've added to my project, but I can't seem to be find a way to diagnose the issue.

Visual Studio 2022 v17.7.0 and Docker Desktop 4.22.0 using latest WSL2 on Windows 10 Pro (32GB RAM, Ryzen 5XXX series CPU).

I have a VS solution with over 40 projects (WebAPI services etc), and the docker compose file has 27 services defined, and these include MongoDb, PostgreSQL and RabbitMQ.

Starting up the project, everything builds fine, but then it gets to this point:

-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------

...and then everything stops...

After waiting several minutes, and hitting the 'Stop Debugging' button, many popups appear (perhaps one per WebAPI service):
image

On occasion VS2022 would completely freeze if I attempt to stop it while it is in this state.

Sometimes it actually continues past this point:

-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.10/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
[02:52:41 WRN] Overriding address(es) 'https://+:443, http://+:80'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.10/System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Step into: Stepping over non-user code 'Program.<Main>'
Step into: Stepping over non-user code 'Program.<Main>$'
Step into: Stepping over non-user code 'Program.<<Main>$>d__0..ctor'
Loaded '/usr/share/dotnet/shared/Microsoft.AspNetCore.App/7.0.10/Microsoft.Extensions.Options.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded '/usr/share/dotnet/shared/Microsoft.AspNetCore.App/7.0.10/Microsoft.Extensions.Logging.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

... and once again, everything stops... no more console output, services can't be connected to etc.

Other times, it works, like nothing was wrong at all, and everything starts up correctly.

This issue is happening with the eShopOnContainers sample too, so it's not limited to my project.

Note that if I use docker compose up outside of Visual Studio, then all docker containers start up correctly and everything works as expected.

I can't quite figure out what is causing all of this. If someone has a solution, then great, and if not, then I would appreciate any guidance as to where I should start looking in order to track down the root cause of this problem.

@rh101
Copy link
Author

rh101 commented Aug 14, 2023

What seems to temporarily fix the issue when it stops working is to do this:

Exit Docker Desktop.
Wait ~10 seconds.
Shut down WSL (wsl --shutdown).
Wait a few seconds.
Restart Docker Desktop
Delete all containers belonging to the project.
Run the project (rebuilds all containers).

After that, everything works fine for at least 5 or so start/stop debugging sessions. Once it fails, repeat above.

@Yomphex
Copy link

Yomphex commented Aug 15, 2023

Can you access vsdebugger.azureedge.net?
In my case it's giving 404 error, something probably went wrong in my country's domain side.

@patverb
Copy link

patverb commented Aug 23, 2023

While launching may take a while (1-2 minutes) sometimes I'm unable to reproduce the issue with the eShopOnContainers example.

Does it happen with high frequency with the eShopOnContainers project? If you have a high repo project you can share that might help diagnose the issue. Even better would be if you posted the issue on DeveloperCommunity and provide a dump file to help me see if I can figure out what's going on.

@rh101
Copy link
Author

rh101 commented Aug 24, 2023

Does it happen with high frequency with the eShopOnContainers project?

Starting and stopping the project approximately 8 times reproduces the issue on my PC.

If you have a high repo project you can share that might help diagnose the issue.

Unfortunately that won't be possible, so I'll need to ensure that I can reproduce the issue with an open source project.

Even better would be if you posted the issue on DeveloperCommunity and provide a dump file to help me see if I can figure out what's going on.

That can be done. Can you please explain how I can generate the dump file that you are referring to? I also have the logs generated by the Docker Desktop diagnostic tool, which was run when the issue occurred, if they would help in any way.

@patverb
Copy link

patverb commented Aug 24, 2023

To create a dump file: open task manager -> details tab -> right click on devenv.exe -> create memory dump file. Do that when VS hanging and that will show what VS is trying to do. You can also throw in the logs too, more information won't hurt.

@rh101
Copy link
Author

rh101 commented Aug 25, 2023

To create a dump file: open task manager -> details tab -> right click on devenv.exe -> create memory dump file. Do that when VS hanging and that will show what VS is trying to do. You can also throw in the logs too, more information won't hurt.

Thank you for the info. The issue has been logged with relevant files attached (devenv dump file was zipped to 1GB): https://developercommunity.visualstudio.com/t/Visual-Studio-2022-and-Docker-project-de/10449745

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

4 participants