MAUI Mac Catalyst app crashes on Intel based MacBooks
See original GitHub issueDescription
The template MAUI app crashes instantly on intel based mac books. It works fine with ARM and M1 based laptops.
The build server is also intel based:
Hardware Overview:
Model Name: iMac
Model Identifier: iMac20,1
Processor Name: 6-Core Intel Core i5
Processor Speed: 3,3 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 12 MB
Hyper-Threading Technology: Enabled
Memory: 32 GB
System Firmware Version: 1715.81.2.0.0 (iBridge: 19.16.10744.0.0,0)
OS Loader Version: 540.80.2~11
Serial Number (system): C02DX08HPN78
Hardware UUID: <GUID>
Provisioning UDID: <GUID>
Activation Lock Status: Enabled
Steps to Reproduce
- Create a new MAUI app using .NET 7
- Go to the MAUI csproj run the following build command
dotnet publish -f net7.0-maccatalyst -c Release -p:CreatePackage=false
- codesign the .app and all inner files with
codesign --verbose --force --deep --strict --options runtime --timestamp --sign
- notarize app
xcrun altool --notarize-app --primary-bundle $id --username $username --password $password
- staple the app
xcrun stapler staple $appname".app"
- Locate the app to an intel based mac book and run the .app
Link to public reproduction project repository
https://github.com/ruofanwang-pp/intel-based-maui-issue
Version with bug
7.0 (current)
Last version that worked well
7.0 (current)
Affected platforms
macOS
Affected platform versions
Mac Catalyst 13.1
Did you find any workaround?
No
Relevant log output
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: MauiExample [
15094
]
Path: /Applications/MauiExample.app/Contents/MacOS/MauiExample
Identifier: com.companyname.mauiexample
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: launchd [
1
]
User ID: 501
Date/Time: 2023-04-19 14: 27: 01.1418 +0200
OS Version: macOS 12.6.3 (21G419)
Report Version: 12
Bridge OS Version: 7.2 (20P3045)
Anonymous UUID: B7969EC7-1612-60C3-626D-B752EDCBA6C0
Time Awake Since Boot: 730 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001,
0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [
15094
]
VM Region Info: 0 is not in any region. Bytes before following region: 4424876032
REGION TYPE START - END [ VSIZE
] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 107be4000-107be8000 [ 16K
] r-x/r-x SM=COW ...S/MauiExample
Thread 0 Crashed: : Dispatch queue: com.apple.main-thread
0 libmonosgen-2.0.dylib 0x108f0c2cd mono_arch_create_sdb_trampoline + 125
1 libmonosgen-2.0.dylib 0x108eb7c1c mini_get_breakpoint_trampoline + 60
2 libmonosgen-2.0.dylib 0x108eecab7 mono_arch_init + 23
3 libmonosgen-2.0.dylib 0x108e0b7f0 mini_init + 816
4 libmonosgen-2.0.dylib 0x108e7120e mono_jit_init_version + 14
5 libxamarin-dotnet.dylib 0x107fcf7a4 xamarin_bridge_initialize + 148
6 libxamarin-dotnet.dylib 0x107fd06f7 xamarin_main + 231
7 MauiExample 0x107be7e04 main + 52
8 dyld 0x115aeb52e start + 462
Thread 1: 0 libsystem_pthread.dylib 0x7ff812516f48 start_wqthread + 0
Thread 2: 0 libsystem_pthread.dylib 0x7ff812516f48 start_wqthread + 0
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007f7eab70d670 rbx: 0x00007f7eab70d670 rcx: 0x00007f7eab70d670 rdx: 0x0000000000000000
rdi: 0x00007f7eab7092e0 rsi: 0x0000000000000000 rbp: 0x00007ff7b831b720 rsp: 0x00007ff7b831b6d0
r8: 0x0000000000000ffe r9: 0x0000000000000495 r10: 0x00000000ffffff00 r11: 0x00000001091f05b8
r12: 0x0000000000000000 r13: 0x0000000000000008 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x0000000108f0c2cd rfl: 0x0000000000010246 cr2: 0x0000000000000000
Logical CPU: 0
Error Code: 0x00000006 (no mapping for user data write)
Trap Number: 14
Thread 0 instruction stream:
45 c8 00 00 00 00 bf 00-02 00 00 e8 a3 a3 ef ff E...............
49 89 c4 41 bd 08 00 00-00 31 ff be 0c 00 00 00 I..A.....1......
ba 04 00 00 00 b9 08 00-00 00 e8 54 a5 ef ff 31 ...........T...1
ff 48 89 c6 e8 4a ee 04-00 48 89 c3 31 ff be 80 .H...J...H..1...
00 00 00 ba 10 00 00 00-b9 f8 ff ff ff e8 31 a5 ..............1.
ef ff 48 89 df 48 89 c6-e8 26 ee 04 00 48 89 c3 ..H..H...&...H..
[
41
]c6 04 24 55 41 bf 01-00 00 00 bf 01 00 00 00 A..$UA.......... <==
be 0e 00 00 00 31 d2 b9-10 00 00 00 e8 02 a5 ef .....1..........
ff 48 89 df 48 89 c6 e8-f7 ed 04 00 48 89 c3 bf .H..H.......H...
01 00 00 00 be 80 00 00-00 ba 05 00 00 00 b9 f0 ................
ff ff ff e8 db a4 ef ff-48 89 df 48 89 c6 e8 d0 ........H..H....
ed 04 00 48 89 c3 66 41-c7 44 24 01 48 8b 41 c6 ...H..fA.D$.H.A.
Binary Images:
0x108cbf000 - 0x1091bafff libmonosgen-2.0.dylib (*) <c6bbe481-08db-39a1-bfd0-b6a2bc3162c0> /Applications/MauiExample.app/Contents/MonoBundle/libmonosgen-2.0.dylib
0x107fb2000 - 0x107fd5fff libxamarin-dotnet.dylib (*) <d83b9338-0f3e-3bfc-b443-b444df79be50> /Applications/MauiExample.app/Contents/MonoBundle/libxamarin-dotnet.dylib
0x107be4000 - 0x107be7fff com.companyname.mauiexample (1.0) <cb166378-2697-3545-9580-40e01dfa324d> /Applications/MauiExample.app/Contents/MacOS/MauiExample
0x115ae6000 - 0x115b51fff dyld (*) <006a3e6f-3cd3-34d9-b0f2-ed6bd67a95a6> /usr/lib/dyld
0x7ff812515000 - 0x7ff812520fff libsystem_pthread.dylib (*) <b5454e27-e8c7-3fdb-b77f-714f1e82e70b> /usr/lib/system/libsystem_pthread.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=1.2G resident=0K(0%) swapped_out_or_unallocated=1.2G(100%)
Writable regions: Total=160.5M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=160.5M(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Activity Tracing 256K 1
ColorSync 4K 1
Dispatch continuations 96.0M 1
Foundation 16K 1
Kernel Alloc Once 8K 1
MALLOC 55.1M 19
MALLOC guard page 16K 4
ObjC additional data 15K 1
STACK GUARD 56.0M 3
Stack 9232K 3
VM_ALLOCATE 12K 3
__CTF 756 1
__DATA 29.9M 606
__DATA_CONST 39.5M 427
__DATA_DIRTY 2075K 268
__FONT_DATA 4K 1
__LINKEDIT 647.4M 15
__TEXT 550.7M 624
__UNICODE 592K 1
dyld private memory 1024K 1
mapped file 29.1M 3
shared memory 592K 7
=========== ======= =======
TOTAL 1.5G 1992
-----------
Full Report
-----------
{
"app_name": "MauiExample",
"timestamp": "2023-04-19 14:27:01.00 +0200",
"app_version": "1.0",
"slice_uuid": "cb166378-2697-3545-9580-40e01dfa324d",
"build_version": "1",
"platform": 6,
"bundleID": "com.companyname.mauiexample",
"share_with_app_devs": 0,
"is_first_party": 0,
"bug_type": "309",
"os_version": "macOS 12.6.3 (21G419)",
"incident_id": "67079CF3-A520-4EB6-9BBC-9AE8F1186F22",
"name": "MauiExample"
}
{
"uptime": 730,
"procLaunch": "2023-04-19 14:27:01.0534 +0200",
"procRole": "Default",
"version": 2,
"userID": 501,
"deployVersion": 210,
"modelCode": "MacBookPro15,1",
"procStartAbsTime": 734772196444,
"coalitionID": 1366,
"osVersion": {
"train": "macOS 12.6.3",
"build": "21G419",
"releaseType": "User"
},
"captureTime": "2023-04-19 14:27:01.1418 +0200",
"incident": "67079CF3-A520-4EB6-9BBC-9AE8F1186F22",
"bug_type": "309",
"pid": 15094,
"procExitAbsTime": 734859975621,
"cpuType": "X86-64",
"procName": "MauiExample",
"procPath": "\/Applications\/MauiExample.app\/Contents\/MacOS\/MauiExample",
"bundleInfo": {
"CFBundleShortVersionString": "1.0",
"CFBundleVersion": "1",
"CFBundleIdentifier": "com.companyname.mauiexample"
},
"storeInfo": {
"deviceIdentifierForVendor": "8FA874F6-2E2C-5AA7-9F2D-4D9CB59925D0",
"thirdParty": true
},
"parentProc": "launchd",
"parentPid": 1,
"coalitionName": "com.companyname.mauiexample",
"crashReporterKey": "B7969EC7-1612-60C3-626D-B752EDCBA6C0",
"bridgeVersion": {
"build": "20P3045",
"train": "7.2"
},
"sip": "enabled",
"vmRegionInfo": "0 is not in any region. Bytes before following region: 4424876032\n REGION TYPE START - END [ VSIZE] PRT\/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 107be4000-107be8000 [ 16K] r-x\/r-x SM=COW ...S\/MauiExample",
"isCorpse": 1,
"exception": {
"codes": "0x0000000000000001, 0x0000000000000000",
"rawCodes": [
1,
0
],
"type": "EXC_BAD_ACCESS",
"signal": "SIGSEGV",
"subtype": "KERN_INVALID_ADDRESS at 0x0000000000000000"
},
"termination": {
"flags": 0,
"code": 11,
"namespace": "SIGNAL",
"indicator": "Segmentation fault: 11",
"byProc": "exc handler",
"byPid": 15094
},
"vmregioninfo": "0 is not in any region. Bytes before following region: 4424876032\n REGION TYPE START - END [ VSIZE] PRT\/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 107be4000-107be8000 [ 16K] r-x\/r-x SM=COW ...S\/MauiExample",
"extMods": {
"caller": {
"thread_create": 0,
"thread_set_state": 0,
"task_for_pid": 0
},
"system": {
"thread_create": 0,
"thread_set_state": 0,
"task_for_pid": 0
},
"targeted": {
"thread_create": 0,
"thread_set_state": 0,
"task_for_pid": 0
},
"warnings": 0
},
"faultingThread": 0,
"threads": [
{
"triggered": true,
"id": 51732,
"instructionState": {
"instructionStream": {
"bytes": [
69,
200,
0,
0,
0,
0,
191,
0,
2,
0,
0,
232,
163,
163,
239,
255,
73,
137,
196,
65,
189,
8,
0,
0,
0,
49,
255,
190,
12,
0,
0,
0,
186,
4,
0,
0,
0,
185,
8,
0,
0,
0,
232,
84,
165,
239,
255,
49,
255,
72,
137,
198,
232,
74,
238,
4,
0,
72,
137,
195,
49,
255,
190,
128,
0,
0,
0,
186,
16,
0,
0,
0,
185,
248,
255,
255,
255,
232,
49,
165,
239,
255,
72,
137,
223,
72,
137,
198,
232,
38,
238,
4,
0,
72,
137,
195,
65,
198,
4,
36,
85,
65,
191,
1,
0,
0,
0,
191,
1,
0,
0,
0,
190,
14,
0,
0,
0,
49,
210,
185,
16,
0,
0,
0,
232,
2,
165,
239,
255,
72,
137,
223,
72,
137,
198,
232,
247,
237,
4,
0,
72,
137,
195,
191,
1,
0,
0,
0,
190,
128,
0,
0,
0,
186,
5,
0,
0,
0,
185,
240,
255,
255,
255,
232,
219,
164,
239,
255,
72,
137,
223,
72,
137,
198,
232,
208,
237,
4,
0,
72,
137,
195,
102,
65,
199,
68,
36,
1,
72,
139,
65,
198
],
"offset": 96
}
},
"threadState": {
"r13": {
"value": 8
},
"rax": {
"value": 140182018905712
},
"rflags": {
"value": 66118
},
"cpu": {
"value": 0
},
"r14": {
"value": 0
},
"rsi": {
"value": 0
},
"r8": {
"value": 4094
},
"cr2": {
"value": 0
},
"rdx": {
"value": 0
},
"r10": {
"value": 4294967040
},
"r9": {
"value": 1173
},
"r15": {
"value": 0
},
"rbx": {
"value": 140182018905712
},
"trap": {
"value": 14,
"description": "(no mapping for user data write)"
},
"err": {
"value": 6
},
"r11": {
"value": 4447995320,
"symbolLocation": 24,
"symbol": "jit_mutex"
},
"rip": {
"value": 4444963533,
"matchesCrashFrame": 1
},
"rbp": {
"value": 140701923915552
},
"rsp": {
"value": 140701923915472
},
"r12": {
"value": 0
},
"rcx": {
"value": 140182018905712
},
"flavor": "x86_THREAD_STATE",
"rdi": {
"value": 140182018888416
}
},
"queue": "com.apple.main-thread",
"frames": [
{
"imageOffset": 2413261,
"symbol": "mono_arch_create_sdb_trampoline",
"symbolLocation": 125,
"imageIndex": 0
},
{
"imageOffset": 2067484,
"symbol": "mini_get_breakpoint_trampoline",
"symbolLocation": 60,
"imageIndex": 0
},
{
"imageOffset": 2284215,
"symbol": "mono_arch_init",
"symbolLocation": 23,
"imageIndex": 0
},
{
"imageOffset": 1361904,
"symbol": "mini_init",
"symbolLocation": 816,
"imageIndex": 0
},
{
"imageOffset": 1778190,
"symbol": "mono_jit_init_version",
"symbolLocation": 14,
"imageIndex": 0
},
{
"imageOffset": 120740,
"symbol": "xamarin_bridge_initialize",
"symbolLocation": 148,
"imageIndex": 1
},
{
"imageOffset": 124663,
"symbol": "xamarin_main",
"symbolLocation": 231,
"imageIndex": 1
},
{
"imageOffset": 15876,
"symbol": "main",
"symbolLocation": 52,
"imageIndex": 2
},
{
"imageOffset": 21806,
"symbol": "start",
"symbolLocation": 462,
"imageIndex": 3
}
]
},
{
"id": 51743,
"frames": [
{
"imageOffset": 8008,
"symbol": "start_wqthread",
"symbolLocation": 0,
"imageIndex": 4
}
]
},
{
"id": 51744,
"frames": [
{
"imageOffset": 8008,
"symbol": "start_wqthread",
"symbolLocation": 0,
"imageIndex": 4
}
]
}
],
"usedImages": [
{
"source": "P",
"arch": "x86_64",
"base": 4442550272,
"size": 5226496,
"uuid": "c6bbe481-08db-39a1-bfd0-b6a2bc3162c0",
"path": "\/Applications\/MauiExample.app\/Contents\/MonoBundle\/libmonosgen-2.0.dylib",
"name": "libmonosgen-2.0.dylib"
},
{
"source": "P",
"arch": "x86_64",
"base": 4428865536,
"size": 147456,
"uuid": "d83b9338-0f3e-3bfc-b443-b444df79be50",
"path": "\/Applications\/MauiExample.app\/Contents\/MonoBundle\/libxamarin-dotnet.dylib",
"name": "libxamarin-dotnet.dylib"
},
{
"source": "P",
"arch": "x86_64",
"base": 4424876032,
"CFBundleShortVersionString": "1.0",
"CFBundleIdentifier": "com.companyname.mauiexample",
"size": 16384,
"uuid": "cb166378-2697-3545-9580-40e01dfa324d",
"path": "\/Applications\/MauiExample.app\/Contents\/MacOS\/MauiExample",
"name": "MauiExample",
"CFBundleVersion": "1"
},
{
"source": "P",
"arch": "x86_64",
"base": 4658716672,
"size": 442368,
"uuid": "006a3e6f-3cd3-34d9-b0f2-ed6bd67a95a6",
"path": "\/usr\/lib\/dyld",
"name": "dyld"
},
{
"source": "P",
"arch": "x86_64",
"base": 140703435935744,
"size": 49152,
"uuid": "b5454e27-e8c7-3fdb-b77f-714f1e82e70b",
"path": "\/usr\/lib\/system\/libsystem_pthread.dylib",
"name": "libsystem_pthread.dylib"
}
],
"sharedCache": {
"base": 140703432679424,
"size": 19331678208,
"uuid": "b6d97ead-9d19-3228-adaa-cca8452c02d2"
},
"vmSummary": "ReadOnly portion of Libraries: Total=1.2G resident=0K(0%) swapped_out_or_unallocated=1.2G(100%)\nWritable regions: Total=160.5M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=160.5M(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nActivity Tracing 256K 1 \nColorSync 4K 1 \nDispatch continuations 96.0M 1 \nFoundation 16K 1 \nKernel Alloc Once 8K 1 \nMALLOC 55.1M 19 \nMALLOC guard page 16K 4 \nObjC additional data 15K 1 \nSTACK GUARD 56.0M 3 \nStack 9232K 3 \nVM_ALLOCATE 12K 3 \n__CTF 756 1 \n__DATA 29.9M 606 \n__DATA_CONST 39.5M 427 \n__DATA_DIRTY 2075K 268 \n__FONT_DATA 4K 1 \n__LINKEDIT 647.4M 15 \n__TEXT 550.7M 624 \n__UNICODE 592K 1 \ndyld private memory 1024K 1 \nmapped file 29.1M 3 \nshared memory 592K 7 \n=========== ======= ======= \nTOTAL 1.5G 1992 \n",
"legacyInfo": {
"threadTriggered": {
"queue": "com.apple.main-thread"
}
},
"trialInfo": {
"rollouts": [
{
"rolloutId": "5fc94383418129005b4e9ae0",
"factorPackIds": {
},
"deploymentId": 240000614
},
{
"rolloutId": "60da5e84ab0ca017dace9abf",
"factorPackIds": {
},
"deploymentId": 240000008
}
Issue Analytics
- State:
- Created 5 months ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Notarized MAUI App crashes instantly on x86_64 MacBooks
I have a working notarized app with an installer working on ARM based MacBooks, but the installed app instantly crashes on Intel based...
Read more >[Mac] MAUI app targeting net6.0-maccatalyst crashes if ...
Description MAUI app on Mac Catalyst with NLua NuGet crashes on startup. Probably the bug is not specific to the NLua NuGet.
Read more >NET MAUI APP Crashing On MAC Machine and IOs device
NET MAUI APP runs fine on windows and Android but crashes on Mac Machine and IOs device, is this because the template is...
Read more >Crash on MacOS(M1 series): uncaught exception ...
Question: I downloaded and run the iOS application on a laptop with M1 processor. System Info: macOS Montery 12.0.1,MacBook Pro (13-inch, M1, 2020)....
Read more >macOS Environment Setup for MAUI Development
MAUI lets you build native apps using a .NET cross-platform UI toolkit with multiple target environments, such as mobile and desktop running on ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This sounds like the app is missing the
com.apple.security.cs.allow-jit
entitlement.It looks like you’re not passing the entitlements to the codesign command.
I would suggest passing
/p:EnableCodesigning=true
todotnet publish
, in addition to a few other properties like this:If you run into this issue with codesign, then you can look at the build log to see the first
codesign
command in the log, and copy that (it’s the secondcodesign
command that fails, the first one is correct).I recognized certain frames in the stack trace from running into the same problem myself in the past.