-
Notifications
You must be signed in to change notification settings - Fork 22
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
dotnet process silently crashes when debugger is attached #444
Comments
Does this code fail when running outside of a container (Debugging or otherwise)? |
Hi @NCarlsonMSFT ! If I run the same code in a Linux container started outside of visual studio and then attach a debugger the process still crashes just with my process' actual name instead of dotnet. I also used the command: DebugAdapterHost.Logging /On /OutputWindow /Verbosity:debug, which is what I assume is what you meant by getting the debugger logs, and saw a lot of handled exceptions before the process exits: But when I run the same code in the same standalone container without the debugger attached everything works as expected. I wonder if all these exceptions, could be causing some problem with the debugger? Do you still want me to try it with WSL debugging? |
Microsoft Visual Studio Professional 2022 Installed Version: Professional Visual C++ 2022 00476-80000-00000-AA511 ADL Tools Service Provider 1.0 ASA Service Provider 1.0 ASP.NET and Web Tools 17.10.344.38934 Azure App Service Tools v3.0.0 17.10.344.38934 Azure Data Lake Tools for Visual Studio 2.6.5000.0 Azure Functions and Web Jobs Tools 17.10.344.38934 Azure Stream Analytics Tools for Visual Studio 2.6.5000.0 C# Tools 4.10.0-3.24372.12+1c559959e2b25fea517c6f89d0c363698421865d Common Azure Tools 1.10 GitHub Copilot 0.2.894.62884 Microsoft Azure Hive Query Language Service 2.6.5000.0 Microsoft Azure Stream Analytics Language Service 2.6.5000.0 Microsoft Azure Tools for Visual Studio 2.9 Microsoft JVM Debugger 1.0 Node.js Tools 1.5.60329.1 Commit Hash:15fce86a17f9f33e5bd7ca7ccb9b216aff149252 NpgsqlVSPackage Extension 1.0 NuGet Package Manager 6.10.2 Razor (ASP.NET Core) 17.10.3.2427201+4f57d1de251e654812adde201c0265a8ca7ca31d SQL Server Data Tools 17.10.178.1 Switch Startup Project 4.2.76 Test Adapter for Boost.Test 1.0 Test Adapter for Google Test 1.0 ToolWindowHostedEditor 1.0 TypeScript Tools 17.0.30327.2001 Visual Basic Tools 4.10.0-3.24372.12+1c559959e2b25fea517c6f89d0c363698421865d Visual F# Tools 17.10.0-beta.24228.1+dd749058c91585e9b5dae62b0f8df892429ee28f Visual Studio IntelliCode 2.2 WiX Toolset Visual Studio Extension 1.0.0.22 |
Thanks @WardenGnaw Here are the logs right as it is exiting:
I can go further back if you think it's hepful. |
It's maybe worth mentioning that this code can be successfully debugged on running on windows without a container. |
Could you provide more lines above the exit event? I'm looking for what |
264","source":{"name":"ExecutionContext.cs","path":"//src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs","sourceReference":0,"checksums":[{"algorithm":"SHA256","checksum":"5098771c4515b115fc5e694d8e79c3523cebd8fda4a73efa7dfa67220105a1c9"}],"vsSourceLinkInfo":{"url":"https://raw.githubusercontent.com/dotnet/runtime/08338fcaa5c9b9a8190abb99222fed12aaba956c/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs","relativeFilePath":"src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs"}},"line":264,"column":17,"endLine":264,"endColumn":40,"instructionPointerReference":"0x00007F0F42FDE553","moduleId":1000},{"id":1030,"name":"System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<MyProgram.Subcomponent.Interfaces.DataContracts.Repository.RepositoryConfig>.AsyncStateMachineBox<MyProgram.Subcomponent.Bar.Engine.Controllers.BarRepositoryDatabaseContext.d__4>.MoveNext(System.Threading.Thread threadPoolThread) Line 385","source":{"name":"AsyncTaskMethodBuilderT.cs","path":"//src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs","sourceReference":0,"checksums":[{"algorithm":"SHA256","checksum":"e358d67bcd5815a50083706ec88d0b8489a9872915d46156ba24277cd21bd662"}],"vsSourceLinkInfo":{"url":"https://raw.githubusercontent.com/dotnet/runtime/08338fcaa5c9b9a8190abb99222fed12aaba956c/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs","relativeFilePath":"src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs"}},"line":385,"column":13,"endLine":385,"endColumn":14,"instructionPointerReference":"0x00007F0F42FC1227","moduleId":1000},{"id":1031,"name":"System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Line 989","source":{"name":"ThreadPoolWorkQueue.cs","path":"//src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs","sourceReference":0,"checksums":[{"algorithm":"SHA256","checksum":"c2320ecffb7fed91e30517804e4bb8bc2f708aec8c6b19e8402c3235be48124e"}],"vsSourceLinkInfo":{"url":"https://raw.githubusercontent.com/dotnet/runtime/08338fcaa5c9b9a8190abb99222fed12aaba956c/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs","relativeFilePath":"src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs"}},"line":989,"column":21,"endLine":989,"endColumn":63,"instructionPointerReference":"0x00007F0F42B65DB2","moduleId":1000},{"id":1032,"name":"System.Private.CoreLib.dll!System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() Line 102","source":{"name":"PortableThreadPool.WorkerThread.NonBrowser.cs","path":"//src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.NonBrowser.cs","sourceReference":0,"checksums":[{"algorithm":"SHA256","checksum":"703b1990b34da9aa45d508433913144bfa7f548c5581d8bcf93b4cad2f41adbd"}],"vsSourceLinkInfo":{"url":"https://raw.githubusercontent.com/dotnet/runtime/08338fcaa5c9b9a8190abb99222fed12aaba956c/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.NonBrowser.cs","relativeFilePath":"src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.NonBrowser.cs"}},"line":102,"column":25,"endLine":102,"endColumn":72,"instructionPointerReference":"0x00007F0F372B20EB","moduleId":1000},{"id":1033,"name":"[Native to Managed Transition]","line":0,"column":0,"presentationHint":"label"},{"id":1034,"name":"[Async Call Stack]","line":0,"column":0,"presentationHint":"label"},{"id":1035,"name":"[Async] MyProgram.Subcomponent.Bar.dll!MyProgram.Subcomponent.Bar.Engine.Controllers.BarRepositoryController.CreateRepositoryAsync(MyProgram.Subcomponent.Interfaces.DataContracts.Repository.RepositoryConfig config, MyProgram.Subcomponent.Interfaces.DataContracts.Repository.CreateBackupRepositoryOptions options, System.Threading.CancellationToken cancellationToken) Line 82","source":{"name":"BarRepositoryController.cs","path":"C:\repos\Explorers\Melon\MyProgram.Subcomponent.Bar\Engine\Controllers\BarRepositoryController.cs","sourceReference":0,"checksums":[{"algorithm":"SHA256","checksum":"77fcf19553c223ba46736b730dc8660e17b4586eeb898e3bcd3bad172cf88886"}]},"line":82,"column":13,"endLine":83,"endColumn":63,"instructionPointerReference":"0x00007F0F4373898B","moduleId":1001}],"totalFrames":36},"seq":1153} |
I hit the char limit so here is some more before that. @WardenGnaw |
From the logs it seems like a However, it may be something within the debugger or runtime is causing the process to exit. To continue further we will need you to capture a dump of the crash to see if something is happening in the runtime.
To keep your crash dump confidential, can you create an issue at https://developercommunity.visualstudio.com/VisualStudio Feel free to paste the link to the bug here so I can assign it to myself and we can continue the discussion there. more information about the environment variable can be found at https://learn.microsoft.com/en-us/dotnet/core/diagnostics/collect-dumps-crash. |
@WardenGnaw @NCarlsonMSFT Just discovered the debugger also cashes when SSH'ed into a normal redhat VM, but the process I'm debugging continues to run. DockerTools is probably the wrong area for this. |
Demo example. Program.cs using System.Diagnostics; namespace TimerCallBackDemo; public class Program
} NativeMethods.cs namespace TimerCallBackDemo; public static class NativeMethods
// Native structures, disable struct warnings
#pragma warning restore CA1815
} |
We have a certain part of our code where the dotnet console process always crashes when the debugger is attached in a docker-compose project. The code executes correctly when started without a debugger, on native linux, and native windows.
System Info
Dotnet info
C:\repos> dotnet --info
Using Rancher Desktop, but also saw the same issue on other machines running Docker Desktop:
Docker version 24.0.7, build afdd53b
Image: mcr.microsoft.com/dotnet/aspnet:8.0
Output from when service starts until dotnet exits:
There is nothing in my application's logs indicating any exception. The code always crashes in the same place unless I start removing objects. There is plenty of other code that runs before it crashes and it's always in one spot. Unfortunately it's proprietary code so I can't paste it here. I'm looking for other ways to dig into what might be going wrong.
I have the app set to generate crash dumps on sig term and this is what I get:
I turned on MS_VS_DOCKER_TOOLS_LOGGING_ENABLED=1 but the logs only contain messages about hot reload writing and reading to the pipe.
The text was updated successfully, but these errors were encountered: