runtime: Debugger crash on macOS (Rosetta 2 on M1)
I’m not sure this is where I need to put this or if you guys are even entertaining bugs for the M1 yet, but here goes…
Repro steps
Debugging the default console “hello world” project in VSCode results in an apparent crash of the debugger:
namespace test
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Debug Console output:
-------------------------------------------------------------------
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/local/share/dotnet/shared/Microsoft.NETCore.App/5.0.0/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Stack overflow.
at System.Collections.HashHelpers.GetPrime(Int32)
at System.Collections.Generic.Dictionary`2[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Initialize(Int32)
at System.Collections.Generic.Dictionary`2[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(Int32, System.Collections.Generic.IEqualityComparer`1<System.__Canon>)
at System.AppContext.Setup(Char**, Char**, Int32)
Running the dll from the command line in a terminal window is successful:
johncoleman@edgar net5.0 % ls
ref test.dll test.runtimeconfig.dev.json
test.deps.json test.pdb test.runtimeconfig.json
johncoleman@edgar net5.0 % dotnet test.dll
Hello World!
johncoleman@edgar net5.0 %
Crash is reproducible, happens every time.
Thanks.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 22
- Comments: 22 (13 by maintainers)
Commits related to this issue
- Allowing arm64 macOS to debug dotnet projects Issue #4277 This commit removes the bit of code that was preventing the .net debugger from starting on Apple Silicon. I've added a warning message that ... — committed to arthurlockman/omnisharp-vscode by arthurlockman 4 years ago
- Allowing arm64 macOS to debug dotnet projects Issue #4277 This commit removes the bit of code that was preventing the .net debugger from starting on Apple Silicon. I've added a warning message that ... — committed to arthurlockman/omnisharp-vscode by arthurlockman 4 years ago
- Allowing arm64 macOS to debug dotnet projects (#4288) * Allowing arm64 macOS to debug dotnet projects Issue #4277 This commit removes the bit of code that was preventing the .net debugger from ... — committed to dotnet/vscode-csharp by arthurlockman 4 years ago
I have found the culprit - it was a Rosetta 2 bug. I have reported it to Apple and it was found that it is actually fixed in 11.1 beta release. I have installed that beta and verified that debugging now starts correctly. But I’ve found another issue behind that. When you set a breakpoint, it gets hit correctly, the debugger breaks in just fine. However, when you single step, the runtime crashes with access violation. I am currently looking into this secondary issue.
@petrkoutnycz We would target fixing this for .NET 5.0 with Rosetta 2.
@janvorli I’ll take a look to see if this issue is fixed with the stack probing fix
I’ve found the culprit for the secondary issue. This one is a Rosetta 2 issue too. I have reported it to Apple.
I can confirm I can repro the issue locally on M1 device. I am looking into it.
I’ve hit the same issue yesterday while testing the 11.2 beta and reported it to Apple. Btw, it seems this is an intermittent issue that doesn’t occur always.
@deejay24 If you have an M1, update your OS. Otherwise, whatever you are running into is different.
Same for me, I was able to debug using Visual Studio for Mac without issue after updating to 11.2 🥳
Can also confirm that debugging in VS for Mac works fine after upgrading to 11.2 (as expected).
I was able to debug in both Rider and VS Code after install of 11.2.
Installed 11.2 and the issue is resolved for me. I can debug in Jetbrains Rider, I can’t say the same for VS Code because I haven’t tried it, but I assume since it was labeled as Rosetta 2 issue one can debug in VS Code too.
Having the same problem. try run without debug