runtime: Debugger doesn't attach on macOS 26
Trying to test simple apps on macOS 26, with VS Code Insiders and C#DK (all latest).
------------------------------------------------------------------------------
You may only use the Microsoft Visual Studio .NET/C/C++ Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you
develop and test your applications.
------------------------------------------------------------------------------
Hello, World!
The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
The program '[12023] test' has exited with code 0 (0x0).
I am seeing this error. It happens with both .NET 9 and .NET 10 latest. It was not happening on Sequoia.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 16
- Comments: 22 (14 by maintainers)
I think this might be related to:
This procedure may help you in the meantime. Though I’m not quite sure if restarts are necessary. Some people have found it helpful.
@lateralusX, Hey!
JFYI I contacted Apple developer support on that matter a few days ago and asked if this is an intended behavior on MacOS 26 (in the MacOS release notes they haven’t mentioned the change, only in iOS & iPadOS notes). And if so, if it is possible to make an exception for apps signed with debugger entitlement). I will post a comment here once I receive an answer.
Hope it helps!
I fixed it by this launch.json @richlander
I’m using a script. I have to run it each time the extension updates. I’m on insiders (VS Code and extensions) so that happens more often for me.
https://gist.github.com/richlander/89abaf1b25bc8796e7a88e9bf9c79d89
Note: The script needs a one line (obvious; line 7) update if you are using regular VS Code.
Tks @markadrake very help full
To be transparent with our plan for this issue, @lateralusX is going to look into what we can do from the runtime side at the beginning of July. If we push any fixes, we anticipate having plenty of time working them through before MacOS 26 goes RTM.
Thank you @eterekhin.
Not a resolution in general, but on the VS Code side, this is resolvable in the C# DevKit pre-release by checking ‘Use Test Signed SDK’ and ‘Use Legacy Dotnet Resolution’. The fix coming out will make it work with only checking ‘Use Test Signed SDK’ which is a hidden setting only discoverable by the vscode setting search.
@nagilson @timheuer FYI
@hoyosjs, Thank you for pointing that out! I got debugger working after
codesign --force -s - /path/to/debugger, same way as dotnet sdk does for executablesI am curious if we may want to work it around in diagnostics? As an example, we could create another child process from dbgshim that would manage the semaphores and signals to dbgshim via pipes. (I tried creating a semaphore between fork and execv from CreateProcessForLaunch, but that didn’t work, runtime was not able to find the semaphore) That’s an alternative to having debuggers unsigned
Can confirm, running under debugger doesn’t work. Even though attach is working
Debugger sequentially calls
CreateProcessForLaunch(bSuspendProcess=1),RegisterForRuntimeStartup,ResumeProcess. AfterRegisterForRuntimeStartupcallm_startupSemis successfully created here AfterResumeProcessruntime can’t opensemStartupsemaphore in PAL_NotifyRuntimeStarted, for some reason it is considered to not exist (please see logs attached below)In logs(stripped) it looks so:
Hope it helps!