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

.NET 9 Applications can randomly freeze when being debugged #112747

Open
auott opened this issue Feb 20, 2025 · 4 comments
Open

.NET 9 Applications can randomly freeze when being debugged #112747

auott opened this issue Feb 20, 2025 · 4 comments
Assignees
Milestone

Comments

@auott
Copy link

auott commented Feb 20, 2025

Description

Debugging a .NET 9 application with Visual Studio can randomly end up freezing the debuggee.
See this issue

Reproduction Steps

Debug an application with many threads that exit while trying to step through code.

Expected behavior

Debuggee does not freeze.

Actual behavior

Debuggee gets stuck with the runtime waiting for all threads to synchronize, but one of the threads being waited has exited so it will never complete.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Feb 20, 2025
Copy link
Contributor

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

@tommcdon tommcdon added this to the 10.0.0 milestone Feb 20, 2025
@tommcdon tommcdon self-assigned this Feb 20, 2025
@tommcdon tommcdon removed the untriaged New issue has not been triaged by the area owner label Feb 20, 2025
@Ollhax
Copy link

Ollhax commented Feb 20, 2025

Hi, I'm the one who reported this issue initially. I'm still seeing the problem a few times a day, let me know if I can try any settings or send you any information that could help you track this down.

@tommcdon
Copy link
Member

Hi @Ollhax! We have a speculative fix for the issue. Would you mind giving it a try to determine if it resolves the issue? I suggest testing on a non-production machine as these are test-only binaries I built locally. To test the changes:

  1. Make a backup copy of the .NET 9 runtime files located in %ProgramFiles%\dotnet\shared\Microsoft.NETCore.App\9.0.2
  2. Download gh112747.zip from https://github.com/tommcdon/runtime/releases/tag/9.0_x64_fix-net9-app-freeze_112747
  3. Copy clrjit.dll, coreclr.dll, mscordaccore.dll, mscordbi.dll, System.Private.CoreLib.dll to %ProgramFiles%\dotnet\shared\Microsoft.NETCore.App\9.0.2\
  4. Follow the instructions on allowing unsigned debugger libraries per https://aka.ms/vs/unsigned-dotnet-debugger-lib
  5. Try to reproduce the debugger bug in Visual Studio

After testing is complete, please restore the original clrjit.dll, coreclr.dll, mscordaccore.dll, mscordbi.dll, System.Private.CoreLib.dll back to %ProgramFiles%\dotnet\shared\Microsoft.NETCore.App\9.0.2, and re-enable debugger library signing checks.

@Ollhax
Copy link

Ollhax commented Feb 20, 2025

Hi @Ollhax! We have a speculative fix for the issue. Would you mind giving it a try to determine if it resolves the issue? I suggest testing on a non-production machine as these are test-only binaries I built locally. To test the changes:

1. Make a backup copy of the .NET 9 runtime files located in %ProgramFiles%\dotnet\shared\Microsoft.NETCore.App\9.0.2

2. Download gh112747.zip from https://github.com/tommcdon/runtime/releases/tag/9.0_x64_fix-net9-app-freeze_112747

3. Copy clrjit.dll, coreclr.dll, mscordaccore.dll, mscordbi.dll, System.Private.CoreLib.dll to  %ProgramFiles%\dotnet\shared\Microsoft.NETCore.App\9.0.2\

4. Follow the instructions on allowing unsigned debugger libraries per https://aka.ms/vs/unsigned-dotnet-debugger-lib

5. Try to reproduce the debugger bug in Visual Studio

After testing is complete, please restore the original clrjit.dll, coreclr.dll, mscordaccore.dll, mscordbi.dll, System.Private.CoreLib.dll back to %ProgramFiles%\dotnet\shared\Microsoft.NETCore.App\9.0.2, and re-enable debugger library signing checks.

Alright, I'll give this a try tomorrow 👍

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

3 participants