Repository navigation
(MAUI) False App Hang on iOS #4150
Copy link
Copy link
Closed
Labels
Description
Package
Sentry.Maui
.NET Flavor
Mono
.NET Version
9.0.4
OS
iOS
OS Version
15.8.4
Development Environment
Visual Studio v17.x
SDK Version
8.46.0
Self-Hosted Sentry Version
24.8.0
Workload Versions
Related to https://github.com/getsentry/team-mobile/issues/186
Calls to clipboard are being marked as app hang on the native code
UseSentry or SentrySdk.Init call
builder.UseSentry((option) =>
{
option.SendDefaultPii = true;
option.ReportAssembliesMode = ReportAssembliesMode.None;
option.Dsn = EnvironmentConfig.SentryDsn;
option.AutoSessionTracking = false;
option.TracesSampleRate = 1.0;
option.AddEventProcessor(new SentryEventProcessor());
option.AddExceptionProcessor(new SentryExceptionProcessor());
option.AddExceptionFilterForType<InvalidSessionException>();
option.Environment = EnvironmentConfig.AppEnvironment.ToString();
option.AttachScreenshot = true;
option.SetBeforeScreenshotCapture(BeforeScreenshotCapture);
if (EnvironmentConfig.AppEnvironment == EAppEnvironment.Prod)
{
option.MaxBreadcrumbs = 50;
}
});
Steps to Reproduce
On an entry field, try to use the clipboard for more than 2 seconds
Expected Result
Should not show app hang event
Actual Result
https://sentry.lkp.app.br/share/issue/b445df88db814198a034bcb6eb6bbaa7/
CoreFoundation 0x180cb3994 <redacted>
CoreFoundation 0x180c8b530 <redacted>
CoreFoundation 0x180c8b530 <redacted>
CoreFoundation 0x180c4cd20 <redacted>
CoreFoundation 0x180c56e48 <redacted>
Foundation 0x1823404e0 <redacted>
UIKitCore 0x183590f7c <redacted>
UIKitCore 0x1831de5ac <redacted>
libobjc.A 0x1984bb7d0 <redacted>
libobjc.A 0x1984b8858 <redacted>
libobjc.A 0x1984c17d4 <redacted>
UIKitCore 0x1834800f8 <redacted>
libobjc.A 0x1984bb7d0 <redacted>
libobjc.A 0x1984b8858 <redacted>
libobjc.A 0x1984c17d4 <redacted>
UIKitCore 0x1832235d8 <redacted>
UIKitCore 0x183123584 <redacted>
UIKitCore 0x183239278 <redacted>
App 0x102d2f56c xamarin_invoke_objc_method_implementation (trampolines.m:649)
App 0x102f7c534 -[Microsoft_Maui_Platform_MauiTextField release] (registrar.mm:11645)
App 0x102d2ca90 xamarin_release_managed_ref (runtime.m:1833)
App 0x102d08c28 interp_to_native_trampoline
App 0x102f2b374 ves_pinvoke_method (interp.c:1811)
App 0x102f1e718 mono_interp_exec_method (interp.c:4287)
App 0x102f1b91c interp_entry_from_trampoline (interp.c:3228)
App 0x102d08cfc native_to_interp_trampoline
App 0x102f94b90 +[__NSObject_Disposer drain:] (registrar.mm:22474)
Foundation 0x182353660 <redacted>
CoreFoundation 0x180cb8448 <redacted>
CoreFoundation 0x180cc8578 <redacted>
CoreFoundation 0x180c0a734 <redacted>
CoreFoundation 0x180c0fe08 <redacted>
CoreFoundation 0x180c23174 <redacted>
GraphicsServices 0x1a1766988 <redacted>
UIKitCore 0x183425a88 <redacted>
UIKitCore 0x1831bef78 <redacted>
App 0x102d21284 xamarin_UIApplicationMain (bindings.m:126)
App 0x102f2ca18 do_icall (interp.c:2426)
App 0x102f2afec do_icall_wrapper (interp.c:2466)
App 0x102f1e564 mono_interp_exec_method (interp.c)
App 0x102f1c120 interp_runtime_invoke (interp.c:2219)
App 0x102ee0b48 mono_jit_runtime_invoke (mini-runtime.c:3685)
App 0x102e7ced8 do_runtime_invoke (object.c:2572)
App 0x102e7ced8 mono_runtime_invoke_checked (object.c:2788)
App 0x102e840b8 do_exec_main_checked (object.c)
App 0x102e840b8 mono_runtime_exec_main_checked (object.c:4808)
App 0x102ee854c mono_jit_exec_internal (driver.c:1366)
App 0x102ee854c mono_jit_exec (driver.c:1311)
App 0x102d353b4 xamarin_main (monotouch-main.m:456)
App 0x102f5d24c main (main.arm64.mm:79)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
- StatusShow more project fieldsNo status
Activity
bruno-garcia commentedon May 3, 2025
@lucas-zimerman we had some other reports/issues with App Hangs with .NET and it seems our heuristics doesn't work well with .NET and the magic the runtime does.
The option should be opt-in now and we added a disclaimer I believe on the option.
jamescrosswell commentedon May 5, 2025
This currently defaults to enabled in the .NET SDK:
sentry-dotnet/src/Sentry/Platforms/Cocoa/SentryOptions.cs
Line 69 in 068f004
It looks like it's also enabled by default in the Cocoa SDK
... although GA of that features hasn't yet been made. Going GA is currently in the Unreleased section of the changelog on the main branch.
At the moment then, it looks like this feature is still experimental/pre-release.
dartasen commentedon Jun 30, 2025
Same problem here, Sentry is spamming in production false positive on iOS
Flash0ver commentedon Jul 1, 2025
@jamescrosswell @bruno-garcia
Should we expose
sentry-cocoaspauseAppHangTracking/resumeAppHangTrackingvia theSentrySdkwhen Platform=Cocoa?Is there a comparable API for
sentry-java(Android) for ANRs?Can/Should we come up with a "conforming" API that works for both?
@lucas-zimerman @dartasen
Wouldoptions.Native.EnableAppHangTracking = true;oroptions.Native.EnableAppHangTrackingV2 = true;work for you?Would
options.Native.EnableAppHangTracking = false;oroptions.Native.EnableAppHangTrackingV2 = false;work for you?dartasen commentedon Jul 1, 2025
@Flash0ver Did you mean = false ?
If so, I guess it should do the trick if it does indeed disable the mechanism that produces those false positives.
Once I get results from production I'll share them in this post.
jamescrosswell commentedon Jul 1, 2025
Quick fix
Yeah if it's not reliable, I think we should make it opt-in rather than opt-out (i.e. default the value of
options.Native.EnableAppHangTrackingtofalse).Long term
There are actually two different versions of AppHangTracking:
V2 was made generally available in the 8.50.0 release of the CocoaSDK, so it might all work much better once we can bump our Cocoa dependency to this version. To do that, we need to be able to sort out the bindings though (massively painful).
App Hang Tracking for iOS is now disabled by default
App Hang Tracking for iOS is now disabled by default (#4320)
Jeanjean commentedon Nov 10, 2025
@Flash0ver @jamescrosswell now that #3601 is completed, is it safe to enable the App Hang Tracking v2 from the SentryMauiOptions? It would also be nice to be able to set enableReportNonFullyBlockingAppHangs from the SentryMauiOptions.
jamescrosswell commentedon Nov 11, 2025
@Jeanjean version 5.16.2 includes v8.57.1 of the Cocoa SDK so yes, with the latest release you should be able to use App Hang Tracking v2. That functionality was made GA in the 8.50.0 release of the Cocoa SDK.