dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.18k stars 1.74k forks source link

Crash when app is deployed with dotnet publish #20981

Closed jeremymarabel closed 7 months ago

jeremymarabel commented 7 months ago

Description

When building and deploying from the IDE all works well, but as soon as we try to build it via CI, using the same configuration it randomly crash after a few minutes/seconds

It seems to be related to a CollectionView issue, as when i remove this composant the crash does not occur. But i can't find any update done from a background thread from my code, and it does not crash when the debugger is attached.

Here is the relevant build config

<UseInterpreter>true</UseInterpreter>
<DefineConstants>DEBUG;ALLOW_CRASH_REPORTING</DefineConstants>
<DebugSymbols>True</DebugSymbols>
  <ApplicationId Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">xxx</ApplicationId>
  <ApplicationId Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">xxx</ApplicationId>
  <RuntimeIdentifier Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">ios-arm64</RuntimeIdentifier>
  <ApplicationTitle>xxx</ApplicationTitle>
  <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
  <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
  <AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
  <AndroidDexTool>d8</AndroidDexTool>
  <AndroidLinkMode>None</AndroidLinkMode>

I've tried with UseInterpreter and Optimize to true and false, without any change in behavior

I cant share the entire project for demonstration, but if needed i can try to create a new sample project that has the same behavior and share it.

Steps to Reproduce

  1. Create an app containing a collectionview
  2. Add some items in the collection
  3. Build and deploy it via dotnet CLI
  4. App crashes after a few seconds/minutes of displaying the page with the CollectionView in it

Link to public reproduction project repository

No response

Version with bug

8.0.6 SR1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 17

Did you find any workaround?

No response

Relevant log output

libsystem_c.dylib __abort
libsystem_c.dylib abort
APP log_callback(char const*, char const*, char const*, int, void*) runtime.m:1180
APP monoeg_g_logv goutput.c:151
APP monoeg_g_log goutput.c:182
APP mono_threads_transition_done_blocking mono-threads-state-machine.c:807
APP mono_threads_exit_gc_safe_region_internal mono-threads-coop.c:378
APP ves_pinvoke_method interp.c:1718
APP mono_interp_exec_method interp.c:4180
APP interp_runtime_invoke interp.c:2109
APP mono_jit_runtime_invoke mini-runtime.c:3672
APP mono_runtime_try_invoke object.c:2576
APP mono_runtime_invoke object.c:2659
APP native_to_managed_trampoline_35(objc_object*, objc_selector*, _MonoMethod**, unsigned int) registrar.mm:1960
APP -[Microsoft_Maui_Controls_Handlers_Items_StructuredItemsViewController_1 viewWillLayoutSubviews] registrar.mm:20961
UIKitCore -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
QuartzCore CA:Layer::layout_if_needed(CA::Transaction*)
QuartzCore CA:Layer::layout_and_display_if_needed(CA::Transaction*)
QuartzCore CA::Context::commit_transaction(CA::Transaction*, double, double*)
QuartzCore CA::Transaction::commit()
QuartzCore CA::Transaction::release_thread(void*)
libsystem_pthread.dylib _pthread_tsd_cleanup
libsystem_pthread.dylib _pthread_exit
libsystem_pthread.dylib pthread_exit
APP mono_threads_platform_exit mono-threads-posix.c:133
APP start_wrapper threads.c:1282
libsystem_pthread.dylib _pthread_start
libsystem_pthread.dylib thread_start
ghost commented 7 months ago

Hi @jeremymarabel. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

PureWeen commented 7 months ago

@rolfbjarne thoughts?

rolfbjarne commented 7 months ago

Can you disable symbol stripping in the project file:

<PropertyGroup>
    <NoSymbolStrip>true</NoSymbolStrip>
</PropertyGroup>

reproduce again, and then check if there are any crash reports (https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#crash-reports) and also check the device log (https://support.apple.com/en-in/guide/console/cnsl1012/mac) for any output there?

jeremymarabel commented 7 months ago

@rolfbjarne Hi, I could not retrieve any recent logs via xcode, for whatever reason, all logs in my device are from last week...

I added the NoSymbolStrip and could get this crash log via appcenter crash reporting tho, hope that helps.

Incident Identifier: 03bab631-33ba-457a-b3e2-1fec130f69b8
CrashReporter Key:   50DE20F6-AD01-49F4-A583-59399B498AB2
Hardware Model:      iPhone15,2
Process:         APP [15778]
Path:            /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/APP
Identifier:      xxx
Version:         7.0.0 (7000000)
Code Type:       arm64
Parent Process:   [1]

Date/Time:       2024-03-04T17:00:10.999Z
Launch Time:     2024-03-04T16:59:15Z
OS Version:      iPhone OS 17.3.1 (21D61)
Report Version:  104

Exception Type:  SIGTRAP
Exception Codes: #0 at 0x19a8d6c44
Crashed Thread:  6

Thread 6 Crashed:
0   libsystem_c.dylib                    0x000000019a8d6c44 __abort + 168
1   libsystem_c.dylib                    0x000000019a8d6b9c abort + 188
2   APP                             0x00000001072e056c log_callback(char const*, char const*, char const*, int, void*) (runtime.m:1180)
3   APP                             0x000000010736d984 monoeg_g_logv (goutput.c:151)
4   APP                             0x000000010736dacc monoeg_g_log (goutput.c:182)
5   APP                             0x0000000107388dbc mono_threads_transition_done_blocking (mono-threads-state-machine.c:807)
6   APP                             0x000000010738a4fc mono_threads_exit_gc_safe_region_unbalanced (mono-threads-coop.c:378)
7   APP                             0x0000000107289528 wrapper_managed_to_native_ObjCRuntime_Messaging_CGSize_objc_msgSendSuper_intptr_intptr + 180
8   APP                             0x00000001071c1a30 UIKit_UICollectionViewLayout_get_CollectionViewContentSize (UICollectionViewLayout.g.cs:664)
9   APP                             0x0000000104d885b0 Microsoft_Maui_Controls_Handlers_Items_ItemsViewController_1_TItemsView_REF_InvalidateMeasureIfContentSizeChanged (D:\a\_work\1\s\src\Controls\src\Core\Handlers\Items\iOS\ItemsViewController.cs:193)
10  APP                             0x0000000104d8841c Microsoft_Maui_Controls_Handlers_Items_ItemsViewController_1_TItemsView_REF_ViewWillLayoutSubviews (D:\a\_work\1\s\src\Controls\src\Core\Handlers\Items\iOS\ItemsViewController.cs:187)
11  APP                             0x0000000104d9a93c Microsoft_Maui_Controls_Handlers_Items_StructuredItemsViewController_1_TItemsView_REF_ViewWillLayoutSubviews (D:\a\_work\1\s\src\Controls\src\Core\Handlers\Items\iOS\StructuredItemsViewController.cs:80)
12  APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
13  APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
14  APP                             0x0000000107443c44 mono_runtime_try_invoke (object.c:2576)
15  APP                             0x0000000107446c94 mono_runtime_invoke (object.c:2659)
16  APP                             0x00000001075aa494 native_to_managed_trampoline_35(objc_object*, objc_selector*, _MonoMethod**, unsigned int) (registrar.mm:1960)
17  APP                             0x00000001075cc200 -[Microsoft_Maui_Controls_Handlers_Items_StructuredItemsViewController_1 viewWillLayoutSubviews] (registrar.mm:20961)
18  UIKitCore                            0x0000000194a7da5c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1100
19  QuartzCore                           0x0000000193e907ec CA::Layer::layout_if_needed(CA::Transaction*) + 496
20  QuartzCore                           0x0000000193e90374 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 140
21  QuartzCore                           0x0000000193e96860 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 460
22  QuartzCore                           0x0000000193e8fb80 CA::Transaction::commit() + 644
23  QuartzCore                           0x0000000194027f80 CA::Transaction::release_thread(void*) + 224
24  libsystem_pthread.dylib              0x00000001fc95ff48 _pthread_tsd_cleanup + 616
25  libsystem_pthread.dylib              0x00000001fc95a880 _pthread_exit + 80
26  libsystem_pthread.dylib              0x00000001fc95b714 pthread_exit + 84
27  APP                             0x00000001073894f8 mono_threads_platform_exit (mono-threads-posix.c:133)
28  APP                             0x000000010745da6c start_wrapper (threads.c:1282)
29  libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
30  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 0:
0   libsystem_kernel.dylib               0x00000001d9fb5178 mach_msg2_trap + 8
1   libsystem_kernel.dylib               0x00000001d9fb4e28 mach_msg_overwrite + 432
2   libsystem_kernel.dylib               0x00000001d9fb4c68 mach_msg + 20
3   CoreFoundation                       0x0000000192853a9c __CFRunLoopServiceMachPort + 156
4   CoreFoundation                       0x0000000192851994 __CFRunLoopRun + 1204
5   CoreFoundation                       0x00000001928513f8 CFRunLoopRunSpecific + 604
6   GraphicsServices                     0x00000001d5e074f8 GSEventRunModal + 160
7   UIKitCore                            0x0000000194c778a0 -[UIApplication _run] + 884
8   UIKitCore                            0x0000000194c76edc UIApplicationMain + 336
9   APP                             0x00000001072d5520 xamarin_UIApplicationMain (bindings.m:126)
10  APP                             0x00000001072852f0 wrapper_managed_to_native_UIKit_UIApplication_xamarin_UIApplicationMain_int_intptr_intptr_intptr_intptr_ + 172
11  APP                             0x00000001071b7ef4 UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr (UIApplication.cs:58)
12  APP                             0x00000001071b810c UIKit_UIApplication_Main_string___System_Type_System_Type (UIApplication.cs:94)
13  APP                             0x0000000103278a6c Smood_Platforms_iOS_Program_Main_string__ (Program.cs:10)
14  APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
15  APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
16  APP                             0x0000000107442c44 mono_runtime_invoke_checked (object.c:2576)
17  APP                             0x000000010744a1a4 mono_runtime_exec_main_checked (object.c:0)
18  APP                             0x00000001074ad64c mono_jit_exec (driver.c:1369)
19  APP                             0x00000001072e983c xamarin_main (monotouch-main.m:495)
20  APP                             0x000000010759f228 main (main.arm64.mm:458)
21  ???                                  0x00000001b55badcc 0x0 + 0

Thread 1:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   libc++.1.dylib                       0x00000001a2a5ff60 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) + 96
2   Usercentrics                         0x000000010f767464 0x10f238000 + 5436516
3   Usercentrics                         0x000000010f767710 0x10f238000 + 5437200
4   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
5   libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 2:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   libc++.1.dylib                       0x00000001a2a5fecc std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
2   Usercentrics                         0x000000010f76b25c 0x10f238000 + 5452380
3   Usercentrics                         0x000000010f76bd48 0x10f238000 + 5455176
4   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
5   libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 3:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   APP                             0x00000001073cfeac thread_func (mono-os-mutex.h:219)
2   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
3   libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 4:
0   libsystem_kernel.dylib               0x00000001d9fb5bf8 __ulock_wait + 8
1   APP                             0x00000001073896d0 mono_native_thread_join (mono-threads-posix.c:344)
2   APP                             0x000000010745cee4 mono_threads_join_threads (threads.c:4371)
3   APP                             0x000000010748541c finalizer_thread (gc.c:863)
4   APP                             0x000000010745d928 start_wrapper (threads.c:1202)
5   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
6   libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 5:
0   libsystem_kernel.dylib               0x00000001d9fb5178 mach_msg2_trap + 8
1   libsystem_kernel.dylib               0x00000001d9fb4e28 mach_msg_overwrite + 432
2   libsystem_kernel.dylib               0x00000001d9fb4c68 mach_msg + 20
3   CoreFoundation                       0x0000000192853a9c __CFRunLoopServiceMachPort + 156
4   CoreFoundation                       0x0000000192851994 __CFRunLoopRun + 1204
5   CoreFoundation                       0x00000001928513f8 CFRunLoopRunSpecific + 604
6   Foundation                           0x00000001917e43ec -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208
7   Foundation                           0x00000001918116ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 60
8   UIKitCore                            0x0000000194bd9710 -[UIEventFetcher threadMain] + 416
9   Foundation                           0x0000000191867d40 __NSThread__start__ + 728
10  libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
11  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 7:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   APP                             0x0000000107085594 wrapper_managed_to_native_Interop_Sys_LowLevelMonitor_Wait_intptr + 128
2   APP                             0x0000000106d6f420 System_Threading_LowLevelMonitor_WaitCore + 44
3   APP                             0x0000000106d6f1ec System_Threading_LowLevelMonitor_Wait + 40
4   APP                             0x0000000106d8eb50 System_Threading_WaitSubsystem_ThreadWaitInfo_Wait_int_bool_bool_System_Threading_WaitSubsystem_LockHolder_ + 268
5   APP                             0x0000000106d90228 System_Threading_WaitSubsystem_WaitableObject_Wait_Locked_System_Threading_WaitSubsystem_ThreadWaitInfo_int_bool_bool_System_Threading_WaitSubsystem_LockHolder_ + 388
6   APP                             0x0000000106d90030 System_Threading_WaitSubsystem_WaitableObject_Wait_System_Threading_WaitSubsystem_ThreadWaitInfo_int_bool_bool + 188
7   APP                             0x0000000106d8db04 System_Threading_WaitSubsystem_Wait_System_Threading_WaitSubsystem_WaitableObject_int_bool_bool + 96
8   APP                             0x0000000106d8da84 System_Threading_WaitSubsystem_Wait_intptr_int_bool + 64
9   APP                             0x0000000106d859a8 System_Threading_WaitHandle_WaitOneCore_intptr_int + 52
10  APP                             0x0000000106d84770 System_Threading_WaitHandle_WaitOneNoCheck_int + 252
11  APP                             0x0000000106d858c0 System_Threading_WaitHandle_WaitOne + 44
12  APP                             0x0000000106d87a70 System_Threading_PortableThreadPool_GateThread_GateThreadStart + 604
13  APP                             0x0000000106d60b70 System_Threading_Thread_StartCallback + 252
14  APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
15  APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
16  APP                             0x0000000107442c44 mono_runtime_invoke_checked (object.c:2576)
17  APP                             0x000000010745da20 start_wrapper (threads.c:1213)
18  libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
19  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 8:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   APP                             0x000000010737d7f0 mono_os_cond_timedwait (mono-os-mutex.c:75)
2   APP                             0x0000000107382154 mono_lifo_semaphore_timed_wait (mono-coop-mutex.h:103)
3   APP                             0x0000000106d63270 wrapper_managed_to_native_System_Threading_LowLevelLifoSemaphore_TimedWaitInternal_intptr_int + 124
4   APP                             0x0000000106d63318 System_Threading_LowLevelLifoSemaphore_WaitCore_int + 52
5   APP                             0x0000000106d63a14 System_Threading_LowLevelLifoSemaphore_WaitForSignal_int + 160
6   APP                             0x0000000106d63930 System_Threading_LowLevelLifoSemaphore_Wait_int_bool + 1116
7   APP                             0x0000000106d8bde8 System_Threading_PortableThreadPool_WorkerThread_WorkerThreadStart + 660
8   APP                             0x0000000106d60b70 System_Threading_Thread_StartCallback + 252
9   APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
10  APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
11  APP                             0x0000000107442c44 mono_runtime_invoke_checked (object.c:2576)
12  APP                             0x000000010745da20 start_wrapper (threads.c:1213)
13  libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
14  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 9:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   APP                             0x000000010737d7f0 mono_os_cond_timedwait (mono-os-mutex.c:75)
2   APP                             0x0000000107382154 mono_lifo_semaphore_timed_wait (mono-coop-mutex.h:103)
3   APP                             0x0000000106d63270 wrapper_managed_to_native_System_Threading_LowLevelLifoSemaphore_TimedWaitInternal_intptr_int + 124
4   APP                             0x0000000106d63318 System_Threading_LowLevelLifoSemaphore_WaitCore_int + 52
5   APP                             0x0000000106d63a14 System_Threading_LowLevelLifoSemaphore_WaitForSignal_int + 160
6   APP                             0x0000000106d63930 System_Threading_LowLevelLifoSemaphore_Wait_int_bool + 1116
7   APP                             0x0000000106d8bde8 System_Threading_PortableThreadPool_WorkerThread_WorkerThreadStart + 660
8   APP                             0x0000000106d60b70 System_Threading_Thread_StartCallback + 252
9   APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
10  APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
11  APP                             0x0000000107442c44 mono_runtime_invoke_checked (object.c:2576)
12  APP                             0x000000010745da20 start_wrapper (threads.c:1213)
13  libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
14  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 10:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   APP                             0x00000001073517f0 SystemNative_LowLevelMonitor_TimedWait (pal_threading.c:177)
2   APP                             0x0000000107086c8c wrapper_managed_to_native_Interop_Sys__LowLevelMonitor_TimedWaitg____PInvoke_67_0_intptr_int + 136
3   APP                             0x0000000106b304d4 Interop_Sys_LowLevelMonitor_TimedWait_intptr_int + 48
4   APP                             0x0000000106d6f494 System_Threading_LowLevelMonitor_WaitCore_int + 80
5   APP                             0x0000000106d6f234 System_Threading_LowLevelMonitor_Wait_int + 48
6   APP                             0x0000000106d8ebd8 System_Threading_WaitSubsystem_ThreadWaitInfo_Wait_int_bool_bool_System_Threading_WaitSubsystem_LockHolder_ + 404
7   APP                             0x0000000106d90228 System_Threading_WaitSubsystem_WaitableObject_Wait_Locked_System_Threading_WaitSubsystem_ThreadWaitInfo_int_bool_bool_System_Threading_WaitSubsystem_LockHolder_ + 388
8   APP                             0x0000000106d90030 System_Threading_WaitSubsystem_WaitableObject_Wait_System_Threading_WaitSubsystem_ThreadWaitInfo_int_bool_bool + 188
9   APP                             0x0000000106d8db04 System_Threading_WaitSubsystem_Wait_System_Threading_WaitSubsystem_WaitableObject_int_bool_bool + 96
10  APP                             0x0000000106d8da84 System_Threading_WaitSubsystem_Wait_intptr_int_bool + 64
11  APP                             0x0000000106d859a8 System_Threading_WaitHandle_WaitOneCore_intptr_int + 52
12  APP                             0x0000000106d84770 System_Threading_WaitHandle_WaitOneNoCheck_int + 252
13  APP                             0x0000000106d84658 System_Threading_WaitHandle_WaitOne_int + 84
14  APP                             0x0000000106d82194 System_Threading_TimerQueue_TimerThread + 304
15  APP                             0x0000000106d60b70 System_Threading_Thread_StartCallback + 252
16  APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
17  APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
18  APP                             0x0000000107442c44 mono_runtime_invoke_checked (object.c:2576)
19  APP                             0x000000010745da20 start_wrapper (threads.c:1213)
20  libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
21  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 11:
0   libsystem_kernel.dylib               0x00000001d9fb5178 mach_msg2_trap + 8
1   libsystem_kernel.dylib               0x00000001d9fb4e28 mach_msg_overwrite + 432
2   libsystem_kernel.dylib               0x00000001d9fb4c68 mach_msg + 20
3   CoreFoundation                       0x0000000192853a9c __CFRunLoopServiceMachPort + 156
4   CoreFoundation                       0x0000000192851994 __CFRunLoopRun + 1204
5   CoreFoundation                       0x00000001928513f8 CFRunLoopRunSpecific + 604
6   CFNetwork                            0x0000000193b4f050 estimatedPropertyListSize + 38184
7   Foundation                           0x0000000191867d40 __NSThread__start__ + 728
8   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
9   libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 12:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   Usercentrics                         0x000000010f778334 0x10f238000 + 5505844
2   Usercentrics                         0x000000010f77765c 0x10f238000 + 5502556
3   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
4   libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 13:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   libc++.1.dylib                       0x00000001a2a5fecc std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
2   Usercentrics                         0x000000010f76bfec 0x10f238000 + 5455852
3   Usercentrics                         0x000000010f76c2bc 0x10f238000 + 5456572
4   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
5   libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 14:
0   libsystem_kernel.dylib               0x00000001d9fb5178 mach_msg2_trap + 8
1   libsystem_kernel.dylib               0x00000001d9fb4e28 mach_msg_overwrite + 432
2   libsystem_kernel.dylib               0x00000001d9fb4c68 mach_msg + 20
3   CoreFoundation                       0x0000000192853a9c __CFRunLoopServiceMachPort + 156
4   CoreFoundation                       0x0000000192851994 __CFRunLoopRun + 1204
5   CoreFoundation                       0x00000001928513f8 CFRunLoopRunSpecific + 604
6   Foundation                           0x00000001917e43ec -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208
7   FirebaseDatabase                     0x00000001104d4bc8 0x11048c000 + 297928
8   Foundation                           0x0000000191867d40 __NSThread__start__ + 728
9   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
10  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 15:
0   libsystem_kernel.dylib               0x00000001d9fc1860 __select + 8
1   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
2   libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 16:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   APP                             0x000000010737d7f0 mono_os_cond_timedwait (mono-os-mutex.c:75)
2   APP                             0x0000000107382154 mono_lifo_semaphore_timed_wait (mono-coop-mutex.h:103)
3   APP                             0x0000000106d63270 wrapper_managed_to_native_System_Threading_LowLevelLifoSemaphore_TimedWaitInternal_intptr_int + 124
4   APP                             0x0000000106d63318 System_Threading_LowLevelLifoSemaphore_WaitCore_int + 52
5   APP                             0x0000000106d63a14 System_Threading_LowLevelLifoSemaphore_WaitForSignal_int + 160
6   APP                             0x0000000106d63930 System_Threading_LowLevelLifoSemaphore_Wait_int_bool + 1116
7   APP                             0x0000000106d8bde8 System_Threading_PortableThreadPool_WorkerThread_WorkerThreadStart + 660
8   APP                             0x0000000106d60b70 System_Threading_Thread_StartCallback + 252
9   APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
10  APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
11  APP                             0x0000000107442c44 mono_runtime_invoke_checked (object.c:2576)
12  APP                             0x000000010745da20 start_wrapper (threads.c:1213)
13  libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
14  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 17:
0   libsystem_kernel.dylib               0x00000001d9fb5b1c __psynch_cvwait + 8
1   APP                             0x000000010737d7f0 mono_os_cond_timedwait (mono-os-mutex.c:75)
2   APP                             0x0000000107382154 mono_lifo_semaphore_timed_wait (mono-coop-mutex.h:103)
3   APP                             0x0000000106d63270 wrapper_managed_to_native_System_Threading_LowLevelLifoSemaphore_TimedWaitInternal_intptr_int + 124
4   APP                             0x0000000106d63318 System_Threading_LowLevelLifoSemaphore_WaitCore_int + 52
5   APP                             0x0000000106d63a14 System_Threading_LowLevelLifoSemaphore_WaitForSignal_int + 160
6   APP                             0x0000000106d63930 System_Threading_LowLevelLifoSemaphore_Wait_int_bool + 1116
7   APP                             0x0000000106d8bde8 System_Threading_PortableThreadPool_WorkerThread_WorkerThreadStart + 660
8   APP                             0x0000000106d60b70 System_Threading_Thread_StartCallback + 252
9   APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
10  APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
11  APP                             0x0000000107442c44 mono_runtime_invoke_checked (object.c:2576)
12  APP                             0x000000010745da20 start_wrapper (threads.c:1213)
13  libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
14  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 18:
0   libsystem_kernel.dylib               0x00000001d9fc2f0c kevent + 8
1   APP                             0x000000010655dc74 wrapper_managed_to_native_Interop_Sys_WaitForSocketEvents_intptr_Interop_Sys_SocketEvent__int_ (<unknown>:1)
2   APP                             0x000000010654802c System_Net_Sockets_SocketAsyncEngine_EventLoop (<unknown>:1)
3   APP                             0x0000000106548af0 System_Net_Sockets_SocketAsyncEngine__c___ctorb__14_0_object (<unknown>:1)
4   APP                             0x0000000106d60bb0 System_Threading_Thread_StartCallback + 316
5   APP                             0x000000010705ce98 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 292
6   APP                             0x00000001074a7110 mono_jit_runtime_invoke (mini-runtime.c:3636)
7   APP                             0x0000000107442c44 mono_runtime_invoke_checked (object.c:2576)
8   APP                             0x000000010745da20 start_wrapper (threads.c:1213)
9   libsystem_pthread.dylib              0x00000001fc9584d4 _pthread_start + 132
10  libsystem_pthread.dylib              0x00000001fc957a10 thread_start + 4

Thread 19:
0   libsystem_kernel.dylib               0x00000001d9fbd6d0 __workq_kernreturn + 8
1   libsystem_pthread.dylib              0x00000001fc957a04 start_wqthread + 4

Thread 20:
0   libsystem_kernel.dylib               0x00000001d9fbd6d0 __workq_kernreturn + 8
1   libsystem_pthread.dylib              0x00000001fc957a04 start_wqthread + 4

Thread 21:
0   libsystem_pthread.dylib              0x00000001fc9579fc start_wqthread + 0

Thread 6 crashed with arm64 Thread State:
   x21: 0x000000016e3dbd70     x2: 0x0000000000000000    x16: 0x0000000000000030     x3: 0x0000000000000001
   x22: 0x000000016e3dbe30     x4: 0x0000000000000000    x17: 0x00000001ed000348   cpsr: 0x0000000040001000
    x5: 0x0000000000989680    x23: 0x000000028339e0d0     x6: 0x0000000000000030    x18: 0x0000000000000000
   x10: 0x00000000000003e8     lr: 0x000000019a8d6c44     x7: 0xffffffff0000c400    x24: 0x000000015f075c10
   x11: 0x00000000b9e0987d     x8: 0x00000000ffffffe7    x19: 0x000000016e3df000    x25: 0x000000016e3dbe20
    x9: 0x00000001e3b82280    x12: 0x00000000000007fb     fp: 0x000000016e3db1c0    x26: 0x000000018c7d6412
   x13: 0x00000000000007fd     pc: 0x000000019a8d6c44    x27: 0x0000000000000000    x14: 0x00000000ba00a075
   x20: 0x000000016e3db1a8     x0: 0x0000000000000000     sp: 0x000000016e3db190    x28: 0x000000015bf09850
   x15: 0x0000000000000075     x1: 0x0000000000000000

Binary Images:
0x00000001023ac000 -        0x00000001077cffff +APP arm64  <77458765ea883c78bde08e2ca063aa3d> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/APP
0x000000010d604000 -        0x000000010d60bfff +UsercentricsUIProxy arm64  <a094754554f437dcad312980864205fc> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/UsercentricsUIProxy.framework/UsercentricsUIProxy
0x000000010d61c000 -        0x000000010d623fff +FirebaseCoreDiagnostics arm64  <9d982b363ab230ddb9e32a6004e26e9c> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics
0x000000010dacc000 -        0x000000010dad3fff +nanopb arm64  <209b8d5a160e3d7395c9ec3eccbe1235> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/nanopb.framework/nanopb
0x000000010db00000 -        0x000000010db0ffff +FirebaseCore arm64  <3f50ffa42e2c3f10bad34d29de3a608e> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FirebaseCore.framework/FirebaseCore
0x000000010db40000 -        0x000000010db4ffff +FBSDKCoreKit_Basics arm64  <2027d442fdbd30bd9f66d49f1af39f00> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics
0x000000010dbb4000 -        0x000000010dbc3fff +FBLPromises arm64  <fb242e46c19339878439ebba20a8f2db> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FBLPromises.framework/FBLPromises
0x000000010dbe4000 -        0x000000010dbeffff +GoogleToolboxForMac arm64  <9ebfff25122e37389e770c30e0c99b16> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac
0x000000010dc18000 -        0x000000010dd4bfff +libHarfBuzzSharp arm64  <9963a21c847c33409c756a1056a8a6b3> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/libHarfBuzzSharp.framework/libHarfBuzzSharp
0x000000010dd64000 -        0x000000010ddaffff +SDWebImage arm64  <0e2821b56c7c3d1899f8d077a1f5f09f> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/SDWebImage.framework/SDWebImage
0x000000010de48000 -        0x000000010dec3fff +UsercentricsUI arm64  <ac6839b2e9283e4abc24a4d8387deaa9> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/UsercentricsUI.framework/UsercentricsUI
0x000000010df00000 -        0x000000010df17fff +FBAEMKit arm64  <1667fccdd1083a09941f1c7d1a499700> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FBAEMKit.framework/FBAEMKit
0x000000010dfd0000 -        0x000000010e0dffff +Appboy_iOS_SDK arm64  <0c6abfb6bc9f3692bb8887e9be326190> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/Appboy_iOS_SDK.framework/Appboy_iOS_SDK
0x000000010e23c000 -        0x000000010e25bfff +GoogleDataTransport arm64  <55d86e7837703932ac2cc9db93e53a7d> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/GoogleDataTransport.framework/GoogleDataTransport
0x000000010e298000 -        0x000000010e29ffff +DTKlarna arm64  <f865c6b26f5d3a498babea205feeb8f6> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/DTKlarna.framework/DTKlarna
0x000000010e324000 -        0x000000010e887fff +libSkiaSharp arm64  <649ef09dce4e3167a06b4c7ae3801717> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
0x000000010e8e8000 -        0x000000010e913fff +GTMSessionFetcher arm64  <84d0325992313d748fa8fee8d60fb6fb> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher
0x000000010e960000 -        0x000000010e97bfff +GoogleUtilities arm64  <ceeb119d01e4353a9a142f9599f8f6ff> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/GoogleUtilities.framework/GoogleUtilities
0x000000010e9b0000 -        0x000000010e9e3fff +leveldb arm64  <705804dddf153aaf9342d696af03bf2f> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/leveldb.framework/leveldb
0x000000010ea64000 -        0x000000010ea8bfff +FBSDKLoginKit arm64  <038b1ee0576132e6aa048e188c18b9a0> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FBSDKLoginKit.framework/FBSDKLoginKit
0x000000010ebe0000 -        0x000000010ec0ffff +GoogleAPIClientForREST arm64  <1f89d70b7f623350957ac8eeaa5e90ef> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/GoogleAPIClientForREST.framework/GoogleAPIClientForREST
0x000000010ece4000 -        0x000000010ecfbfff +FirebaseInstallations arm64  <9243fd05262f37e1b589135955eb9569> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FirebaseInstallations.framework/FirebaseInstallations
0x000000010ed2c000 -        0x000000010ed33fff +FBSDKGamingServicesKit arm64  <9c45f89d3ea73e0fa82aea261d30e5ec> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FBSDKGamingServicesKit.framework/FBSDKGamingServicesKit
0x000000010ed68000 -        0x000000010ed8bfff +FBSDKShareKit arm64  <88c90c69cc813b1a9a11d6792ab44daa> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FBSDKShareKit.framework/FBSDKShareKit
0x000000010eef0000 -        0x000000010ef17fff +PhraseSDK arm64  <ea4c29b7085433bbadc3f42a0ab99ef9> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/PhraseSDK.framework/PhraseSDK
0x000000010efe0000 -        0x000000010f027fff +Protobuf arm64  <9447cd88c361327788f90d8681b27997> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/Protobuf.framework/Protobuf
0x000000010f238000 -        0x000000010f7fffff +Usercentrics arm64  <574c95f39b203583946109770192c493> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/Usercentrics.framework/Usercentrics
0x000000010fb98000 -        0x000000010fc4bfff +FBSDKCoreKit arm64  <33d96430d26e33a7bf6047280a8e5fe8> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FBSDKCoreKit.framework/FBSDKCoreKit
0x000000011048c000 -        0x000000011050ffff +FirebaseDatabase arm64  <fabeefb7fea532a8b8484ec772db29b5> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FirebaseDatabase.framework/FirebaseDatabase
0x00000001107e8000 -        0x000000011081ffff +PPRiskMagnes arm64  <7719096182b4383593b0e17efe0be13c> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/PPRiskMagnes.framework/PPRiskMagnes
0x0000000110c64000 -        0x0000000110c9ffff +FacebookGamingServices arm64  <616c6115435a3433a2c4156f97c2d7f0> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/FacebookGamingServices.framework/FacebookGamingServices
0x0000000111008000 -        0x00000001110effff +Datatrans arm64  <729878137827366da94c39a9e2c56d16> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/Datatrans.framework/Datatrans
0x00000001127e8000 -        0x0000000112a17fff +DTCardScanner arm64  <63f74589ef03350897d28455b7c0dc89> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/DTCardScanner.framework/DTCardScanner
0x0000000114684000 -        0x000000011480ffff +KlarnaMobileSDK arm64  <73b0aa49ccde3440a724439f591c80f3> /private/var/containers/Bundle/Application/D2544B21-39AA-4E7D-8FAB-380761A13E73/APP.app/Frameworks/KlarnaMobileSDK.framework/KlarnaMobileSDK
0x00000001917b8000 -        0x0000000192317fff  Foundation arm64e  <5623831d571933a99691759f47d714d1> /System/Library/Frameworks/Foundation.framework/Foundation
0x000000019281e000 -        0x0000000192d4afff  CoreFoundation arm64e  <5a6c1f41bf7032f6a1d65b894dd21362> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x00000001938f5000 -        0x0000000193cd0fff  CFNetwork arm64e  <650b083ce6403f12a26732148f1eb6b8> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x0000000193e2a000 -        0x00000001941cbfff  QuartzCore arm64e  <5c3ee3d91aaa3052a6c7b957b454ad71> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x0000000194a4b000 -        0x0000000196521fff  UIKitCore arm64e  <2d5384466e403c108a5f559c938077a0> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x000000019a861000 -        0x000000019a8deff3  libsystem_c.dylib arm64e  <6d03d4f6ec2f3c189013b4caf90539af> /usr/lib/system/libsystem_c.dylib
0x00000001a2a4d000 -        0x00000001a2adafff  libc++.1.dylib arm64e  <88c06a0348273faba02b4dc1fe8a42b6> /usr/lib/libc++.1.dylib
0x00000001d5e04000 -        0x00000001d5e0cfff  GraphicsServices arm64e  <ac07ebbed8bc3e55a13a07bb548734d1> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x00000001d9fb4000 -        0x00000001d9fecfef  libsystem_kernel.dylib arm64e  <08f02c6b1443366598054a8bee87346e> /usr/lib/system/libsystem_kernel.dylib
0x00000001fc956000 -        0x00000001fc961ff3  libsystem_pthread.dylib arm64e  <8f9c865b29f5346badd5fde40e008c66> /usr/lib/system/libsystem_pthread.dylib
rolfbjarne commented 7 months ago

So that's much more helpful:

Thread 6 Crashed:
0   libsystem_c.dylib                    0x000000019a8d6c44 __abort + 168
1   libsystem_c.dylib                    0x000000019a8d6b9c abort + 188
2   APP                             0x00000001072e056c log_callback(char const*, char const*, char const*, int, void*) (runtime.m:1180)
3   APP                             0x000000010736d984 monoeg_g_logv (goutput.c:151)
4   APP                             0x000000010736dacc monoeg_g_log (goutput.c:182)
5   APP                             0x0000000107388dbc mono_threads_transition_done_blocking (mono-threads-state-machine.c:807)
6   APP                             0x000000010738a4fc mono_threads_exit_gc_safe_region_unbalanced (mono-threads-coop.c:378)
7   APP                             0x0000000107289528 wrapper_managed_to_native_ObjCRuntime_Messaging_CGSize_objc_msgSendSuper_intptr_intptr + 180
[...]

This is probably an issue on our side, but the bad news is that we'll need a way to reproduce this ourselves in order to track it down.

ghost commented 7 months ago

Hi @jeremymarabel. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

IsmailHassani commented 7 months ago

Hi guys, hope you're all well with this journey. ;)

I stumbled on this issue last week after multiple submissions to the MS Store where the application crashed on startup. The problem can have multiple causes, but to solve this issue, you have to take several steps that aren't very obvious.

Disable optimization

First step is to disable optimization on build. Add this line to the PropertyGroup of your project: <Optimize>False</Optimize> If you don't, the app will just crash without any warning or visible activity. After successfully running you're app, you can remove this line. For now we want to have as minimal changes as the Debug configuration.

Add logging

The second step is to add logging (AppCenter, Application Insights or Sentry) as early as possible to detect crashes and errors in the early stage of the application startup. I used AppCenter and it gave me enough info to proceed to the next exception on the stack. You can take a look in my Sample application.

The issues i encountered:

ObservableCollection initialization with existing list should be avoided if this list could be null.

image

Instead of using:

var list = new ObservableCollection<object>(oldList);

Try using the AddRange extension or similar to ensure this collection is not empty. I don't know why, but since .net 8 something has changed that causes this behavior.

var list = new ObservableCollection<object>()
list.AddRange(oldList)

This extension ensures that the collection is never null. If you can guarantee that list is not null, than you can keep using the initializer.

foreach on a list while list is null causes crash.

Instead of using:

foreach (var item in list)

Try use the EnsureNotNull extension or similar to ensure that the collection is null.

foreach (var item in list.EnsureNotNull())

Check your order of styles in the resource dictionary.

If you use DependentOn in your style, ensure that the depended style is on top of your style. As far as i know this was not an issue in the past, but it looks like the DependentOn searches the dictionary upwards causing the referenced style not to be found. Maybe this is done for performance reasons, but this could explain the multiple resource exceptions in 3th party libraries recently.

Don't use async methods in the MauiProgram

Try to avoid the use of async methods in the MauiProgram. Also don't use .GetAwaiter().GetResult() which can cause deadlocks. The problem is that it works in Debug mode without any issues, but not in Release mode. I mention this, because i tried to load an appsetting.json file on startup by using

public async Task<MauiApp> CreateMauiAppAsync()
{
        var builder = MauiApp.CreateBuilder();
IConfigurationRoot config = new ConfigurationBuilder()
            .AddJsonStream(await FileSystem.OpenAppPackageFileAsync("appsettings.json"))
            .Build();
    ...
}

I changed this file to an embedded resource and changed the code to:

public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
    var mainAssembly = Assembly.GetAssembly(typeof(App));

    var configBuilder = new ConfigurationBuilder();
    configBuilder.AddJsonStream(mainAssembly.GetManifestResourceStream("Sample.appsettings.json"));
    var config = configBuilder.Build();
    ...
}

Check that all your views, pages and windows use the correct base class

This is no brainer but, sometimes the view.xaml.cs file could use a different base class (ContentPage or interface). Just to be sure.

All the views and windows should have x:DataType set to the ViewModel

On build you get a lot of errors/warnings that the page is missing the datatype for the compiled binding even you're using the regular {Binding}.

<c:View 
    xmlns:c="clr-namespace:ISynergy.Framework.UI.Controls;assembly=ISynergy.Framework.UI.Maui"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Sample.Views.ControlsView"
    xmlns:viewmodels="clr-namespace:Sample.ViewModels;assembly=Sample.Shared"
    x:DataType="viewmodels:ControlsViewModel"
    Title="ControlsView">

If you want to disable this behavior add the following attribute on top of the xaml.cs class:

[XamlCompilation(XamlCompilationOptions.Skip)]

Use the correct build statement to generate the msix

The right command is very important to generate a package that could be installed correctly.

Sideload

dotnet publish "samples/isynergy.framework.ui.maui/sample.maui/sample.maui.csproj" -c Release -f net8.0-windows10.0.22621.0 --self-contained true --runtime win-x64  -p:Platform=x64 -p:AppxPackageSigningEnabled=true -p:PackagecertificateThumbprint=xxxxxxxx -p:UapAppxPackageBuildMode=SideloadOnly -p:AppxBundle=Never

dotnet publish "samples/isynergy.framework.ui.maui/sample.maui/sample.maui.csproj" -c Release -f net8.0-windows10.0.22621.0 --self-contained true --runtime win-x86  -p:Platform=x86 -p:AppxPackageSigningEnabled=true -p:PackagecertificateThumbprint=xxxxxxxx -p:UapAppxPackageBuildMode=SideloadOnly -p:AppxBundle=Never

Store upload

dotnet publish "samples/isynergy.framework.ui.maui/sample.maui/sample.maui.csproj" -c Release -f net8.0-windows10.0.22621.0 --self-contained true --runtime win-x64  -p:Platform=x64 -p:UapAppxPackageBuildMode=StoreUpload -p:AppxBundle=Never

dotnet publish "samples/isynergy.framework.ui.maui/sample.maui/sample.maui.csproj" -c Release -f net8.0-windows10.0.22621.0 --self-contained true --runtime win-x86  -p:Platform=x86 -p:UapAppxPackageBuildMode=StoreUpload -p:AppxBundle=Never

Remove the Maui CommunityToolkit (not verified!)

I don't know if this also causes issues. Many people advice to remove it. Especially when you don't use it.

After spending the whole night in this rabbit hole, i managed to get the sample app running in Release mode. Hope it helps.

dotnet-policy-service[bot] commented 7 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.