Repository navigation
mono_gc_run_finalize iOS crash #107641
Copy link
Copy link
Closed
Labels
Description
Description
I'm getting some crash reports from a small number of users when opening our MAUI app on iOS with the following stack trace:
0 libsystem_kernel.dylib 0x00000001e74eb42c __pthread_kill + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001fb28ac0c pthread_kill + 268 (pthread.c:1721)
2 libsystem_c.dylib 0x00000001a638eba0 abort + 180 (abort.c:118)
3 QMCMobile 0x00000001031f29ac 0x102a80000 + 7809452
4 QMCMobile 0x000000010317630c mono_runtime_setup_stat_profiler + 0 (mini-posix.c:662)
5 libsystem_platform.dylib 0x00000001fb1cee9c _sigtramp + 56 (sigtramp.c:116)
6 libsystem_pthread.dylib 0x00000001fb28ac0c pthread_kill + 268 (pthread.c:1721)
7 libsystem_c.dylib 0x00000001a638eba0 abort + 180 (abort.c:118)
8 QMCMobile 0x0000000102ea9dd4 print_callback(char const*, int) + 0 (runtime.m:1201)
9 QMCMobile 0x000000010302bfd0 monoeg_g_logv_nofree + 212 (goutput.c:167)
10 QMCMobile 0x000000010302c040 monoeg_assertion_message + 40 (goutput.c:207)
11 QMCMobile 0x00000001030f4bac mono_unhandled_exception_checked + 0 (object.c:4540)
12 QMCMobile 0x00000001031030c4 mono_thread_internal_unhandled_exception + 48 (threads.c:4673)
13 QMCMobile 0x0000000103125ec4 mono_gc_run_finalize + 684 (gc.c:352)
14 QMCMobile 0x0000000103050624 sgen_gc_invoke_finalizers + 192 (sgen-gc.c:2852)
15 QMCMobile 0x00000001031270d8 finalizer_thread + 776 (gc.c:905)
16 QMCMobile 0x000000010310395c start_wrapper + 352 (threads.c:1271)
17 libsystem_pthread.dylib 0x00000001fb28906c _pthread_start + 136 (pthread.c:931)
18 libsystem_pthread.dylib 0x00000001fb2840d8 thread_start + 8 (:-1)
Complete crash report attached
2024-09-05_11-36-23.7199_+0100-a81f98656fd14cd6ee1031f7089dfc2e6b30f05c.txt
Steps to Reproduce
Unknown
Link to public reproduction project repository
No response
Version with bug
8.0.82 SR8.2
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
Relevant log output
No response
Reactions are currently unavailable
Activity
github-actions commentedon Sep 5, 2024
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Open similar issues:
Closed similar issues:
drasticactions commentedon Sep 6, 2024
This could be an issue in the runtime, considering that it seems that something is throwing in
mono_gc_run_finalize. This may not be a MAUI UI specific issue. @rolfbjarne What do you think?rolfbjarne commentedon Sep 6, 2024
The problem is that a finalizer threw an exception:
The trick is figuring out more information about the exception.
My advice would be to add event listeners to both of these:
And log/upload any results to your telemetry solution of choice.
timmac-qmc commentedon Sep 7, 2024
Implemented and nothing appears to be getting captured...
timmac-qmc commentedon Sep 9, 2024
May be unrelated but after trawling through logs the following is showing consistently:
I'm using the following code as given by the documentation so I'm not sure why this error is occurring?
Documentation clearly states that TeamID is prepended to the security group string.
EDIT:
Seems I'm not the first user to encounter this:
AzureAD/microsoft-authentication-library-for-dotnet#1562
rolfbjarne commentedon Sep 9, 2024
This is not the direct cause of the crash (it may cause other issues in your app though; and technically it may even be an indirect cause of the crash if it's causing exceptions on the finalizer thread).
timmac-qmc commentedon Sep 9, 2024
I'm at a bit of a loss here, nothing seems to be getting captured or reported. Is there anything else you can suggest to track down the cause?
I'm using the code below to try and catch everything but nothing shows in the device console:
rolfbjarne commentedon Sep 9, 2024
Can you share the device log for a crash + the corresponding crash report?
timmac-qmc commentedon Sep 10, 2024
Just noticed in the log
Could not find
System.Runtime.InteropServices.JavaScriptreferenced by assemblyQMCMobile, Version=2.0.7.0, Culture=neutral, PublicKeyToken=null.rolfbjarne commentedon Sep 10, 2024
That could be a good place to start looking, although it's strange that this didn't cause a build failure.
I didn't find anything else in the log, so if that doesn't lead anywhere, can you zip up the .app that's installed on your device and attach it / link to it here (it should be somewhere inside the bin directory of your project folder)?
timmac-qmc commentedon Sep 10, 2024
Resolved using config below, app still crashes.
No crash report is currently being generated on the device.
crash_log.txt
QMCMobile.app.zip
rolfbjarne commentedon Sep 10, 2024
All files in this zip are zero-sized, so I assume you're building from Windows.
In that case, you need to get the real app contents from your macOS machine.
It's somewhere in this directory:
timmac-qmc commentedon Sep 10, 2024
Folder structure is a bit different but hopefully this is what you need:
rolfbjarne commentedon Sep 10, 2024
TIL that I can't access mega.nz for security reasons.
Is there any possibility you can use another file sharing service?
4 remaining items
dotnet-policy-service commentedon Sep 11, 2024
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.
Flash3001 commentedon May 15, 2025
@rolfbjarne What is the status of this issue? There is a pull request #110863 that was released on 9.0.200 that mentions this issue. But this ticket is still opened.
I started having this problem (or very similar) after updating to 9.0.200 though.
rolfbjarne commentedon May 19, 2025
We never got a test project we could use to reproduce this. Since you're seeing the same problem, would you be able to provide a test project?
timmac-qmc commentedon May 22, 2025
Apologies I never got back to this due to time constraints.
I never found the root cause but managed to work around the crash by using the following project configuration
BrzVlad commentedon Jun 11, 2025
Doesn't seem we can address this without a repro. Feel free to reopen if you manage to reproduce this in a sample application.