runtime: [macOS] cannot debug / stop at breakpoints when app sandbox is enabled
From @tipa on Mon, 14 Nov 2022 22:18:23 GMT
Steps to Reproduce
- Create new .NET macOS app (doesn’t matter if .net6 or .net7)
- Enable app sandbox in Entitlements.plist (see snippet below)
- Create breakpoint somewhere in code
- Start debugging
<key>com.apple.security.app-sandbox</key>
<true/>
Expected Behavior
Code execution stops on breakpoints and developer can inspect variables etc

Actual Behavior
No breakpoint is hit, breakpoints show as inactive

Comments
Debugging and hitting breakpoints worked without problems in legacy Xamarin, even when App Sandbox was enabled
Environment
Version information
Visual Studio Community 2022 for Mac
Version 17.4 (build 2406)
Installation UUID: 39a1422f-61e9-466b-9c35-a80fcd9a2d23
Runtime
.NET 6.0.9 (64-bit)
Architecture: Arm64
Roslyn (Language Service)
5.4.0-3.22461.4+8ab250290a4010c11a21521f78dbc87dbb7aac81
NuGet
Version: 6.3.1.1
.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/7.0.100/Sdks
SDK Versions:
7.0.100
6.0.403
6.0.402
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks
.NET SDK (x64)
SDK Versions:
3.1.425
3.1.424
.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
7.0.0
7.0.0-rc.2.22472.3
6.0.11
6.0.10
.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Versions:
3.1.31
3.1.30
Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Xamarin.Android
Not Installed
Microsoft Build of OpenJDK
Java SDK: Not Found
Eclipse Temurin JDK
Java SDK: Not Found
Android SDK Manager
Version: 17.4.0.54
Hash: 6eabb9e
Branch: remotes/origin/d17-4
Build date: 2022-11-02 23:47:26 UTC
Android Device Manager
Version: 0.0.0.1206
Hash: 886af39
Branch: 886af39
Build date: 2022-11-02 23:47:26 UTC
Apple Developer Tools
Xcode 14.1 (21534.1)
Build 14B47b
Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400
Xamarin.iOS
Version: 16.0.0.72 (Visual Studio Community)
Hash: 6756a1146
Branch: release/6.0.4xx-xcode14
Build date: 2022-09-21 08:51:06-0400
Xamarin Designer
Version: 17.4.0.136
Hash: d49c9ff6d3
Branch: remotes/origin/d17-4
Build date: 2022-11-02 23:47:17 UTC
Build Information
Release ID: 1704002406
Git revision: dfb45c1152306f0d5f77334f9d026b0aadb7ec90
Build date: 2022-11-02 23:44:22+00
Build branch: release-17.4
Build lane: release-17.4
Operating System
Mac OS X 13.0.1
Darwin 22.1.0 Darwin Kernel Version 22.1.0
Sun Oct 9 20:14:30 PDT 2022
root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64
Example Project (If Possible)
Copied from original issue xamarin/xamarin-macios#16753
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 27 (18 by maintainers)
You can try this to build for arm64:
I wasn’t aware .NET 6/7 changed the way they debug Xamarin apps.
We can verify if VS is now using dbgshim by doing the following:
You will need to replace the [App Group Id] with an application group id specific for your product.
This should allow the vs debugger to debug the sandboxed app.