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

Mac Sonoma 14.4.1 with arm arch fails to start x64 debug #7957

Closed
Sh18RW opened this issue Feb 2, 2025 · 10 comments
Closed

Mac Sonoma 14.4.1 with arm arch fails to start x64 debug #7957

Sh18RW opened this issue Feb 2, 2025 · 10 comments

Comments

@Sh18RW
Copy link

Sh18RW commented Feb 2, 2025

Environment data

dotnet --info output:

.NET SDK:
 Version:           9.0.102
 Commit:            cb83cd4923
 Workload version:  9.0.100-manifests.7c7c79ca
 MSBuild version:   17.12.18+ed8c6aec5

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.4
 OS Platform: Darwin
 RID:         osx-x64
 Base Path:   /usr/local/share/dotnet/x64/sdk/9.0.102/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.1
  Architecture: x64
  Commit:       c8acea2262

.NET SDKs installed:
  9.0.100-preview.1.24101.2 [/usr/local/share/dotnet/x64/sdk]
  9.0.102 [/usr/local/share/dotnet/x64/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-preview.1.24081.5 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.1 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-preview.1.24080.9 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.1 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]

Other architectures found:
  arm64 [/usr/local/share/dotnet]
    registered at [/etc/dotnet/install_location_arm64]

Environment variables:
  DOTNET_ROOT_ARM   [/usr/local/share/dotnet]
  DOTNET_ROOT_X64   [/usr/local/share/dotnet/x64]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

VS Code version: 1.96.4 (Universal)
C# Extension version: 2.61.28

Steps to reproduce

Set a launch option

{
            "name": "Mac x64 Server",
            "type": "coreclr",
            "request": "launch",
            "program": "/usr/local/share/dotnet/x64/dotnet",
            "args": ["${workspaceFolder}/bin/Content.Server/Content.Server.dll"],
            "console": "integratedTerminal",
            "stopAtEntry": false,
            "targetArchitecture": "x86_64",
        },

and start to debug.

Behavior

I need to switch from ARM to x64 for my .NET project. The project has been migrated from .NET 8 to .NET 9, and now I need to use version 9. However, for some reason, the x64 SDK is not working properly for debugging, and it can only be used for running the project. ARM versions are working fine (but I cannot use it).
So if I start debug, it begins to execute, but suddenly stops without any message.
Also the debug console contains

------------------------------------------------------------------------------
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.
------------------------------------------------------------------------------
dotnet (85191): Loaded '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/9.0.1/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[85191] dotnet' has exited with code 0 (0x0).

I am not sure if it is a .NET 9 issue, but I have not been able to find anything similar. Perhaps it is just a problem on my end for some reason.

@Sh18RW
Copy link
Author

Sh18RW commented Feb 3, 2025

dotnet/sdk#43206
I found...

@gregg-miskelly
Copy link
Contributor

What is printed to the integrated terminal?

@Sh18RW
Copy link
Author

Sh18RW commented Feb 3, 2025

What is printed to the integrated terminal?

There is nothing.

Image

@gregg-miskelly
Copy link
Contributor

If you try running /usr/local/share/dotnet/x64/dotnet **insert-workspace-folder-path-here**/bin/Content.Server/Content.Server.dll from a terminal do you see anything?

From a debugger perspective, there isn't an obvious problem -- it looks like the target process just decides to exit for some reason. I don't know why that reason isn't printed to the terminal, but probably worth trying from a real console.

@Sh18RW
Copy link
Author

Sh18RW commented Feb 4, 2025

The program started. I also tried using Rider, but the same problem occurred. If I start debugging, it stops working. However, just running the code works fine.

@gregg-miskelly
Copy link
Contributor

gregg-miskelly commented Feb 4, 2025

Interesting. Sounds like maybe there is something incompatible between Rossetta emulation of the very low-level debugging primitives the runtime uses.

A few ideas to troubleshoot next:

  1. Can you reproduce this problem with a "Hello World" .NET 9 ASP.NET Core project? (I am assuming your real project is ASP.NET Core, if not, replace with whatever project type you are using)
  2. Can you try turning on 'debug runtime event tracing' (see below)
  3. If this isn't too hard to try -- does the problem happen if you target .NET 8 instead of .NET 9?

launch.json setting to turn on logging:

"logging": {
                "diagnosticsLog": {
                    "debugRuntimeEventTracing": true
                }
            }

@Sh18RW
Copy link
Author

Sh18RW commented Feb 4, 2025

1-2. I created an empty APS.NET project:

Using launch settings from '/Users/petrsmirnov/Projects/sandbox/WebApplication21/Properties/launchSettings.json' [Profile 'https']...
[Debug Runtime Event] DBI Callback -- CreateProcess(Process:00007F842E07AE28)
[Debug Runtime Event] DBI Callback -- CreateAppDomain(Process:00007F842E07AE28, AppDomain:00007F842D8250F8)
[Debug Runtime Event] DBI Callback -- LoadAssembly(AppDomain:00007F842D8250F8, Assembly:00007F842DA607C8)
[Debug Runtime Event] DBI Callback -- LoadModule(AppDomain:00007F842D8250F8, Module:00007F842D8242C8)
WebApplication21.dll (28998): Loaded '/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App/9.0.1/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
[Debug Runtime Event] DBI Callback -- NameChange(AppDomain:00007F842D8250F8, Thread:0000000000000000)
[Debug Runtime Event] DBI Callback -- CreateThread(AppDomain:00007F842D8250F8, Thread:00007F842CF514B8)
  1. If I build with dotnet build -p:TargetFramwork=net8.0.12, debugging starts.

@gregg-miskelly
Copy link
Contributor

Thanks! With your information I was able to reproduce this as well. I couldn't find an issue for it in the .NET Runtime repo, so I opened one: dotnet/runtime#112137

@Sh18RW
Copy link
Author

Sh18RW commented Feb 4, 2025

Thanks!

@Sh18RW
Copy link
Author

Sh18RW commented Feb 19, 2025

The issue no longer reproduces, it is more likely Rosetta has fixed.

@Sh18RW Sh18RW closed this as completed Feb 19, 2025
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