Closed Yahya0007 closed 1 month ago
I NEED THE CLIENT CODE! My goodness dude... I make OSS for the client.
Hi Allan MAUI project here; https://github.com/Yahya0007/StaffAppMAUI3.2 I had to remove sensitive info. If needed I can provide unchanged project privately. Thanks Regards
You only need one.
NOTE: current firebase on iOS needs to be updated to v4.0 betas due to the change in bindings required for the firebase version.
Hi Allan Many thanks. Original complete PushDleegate code which inserts notification into sqlite table is here; https://github.com/Yahya0007/StaffAppMAUI3.2/blob/master/StaffAppMAUI/Shiny/PushDelegate.cs This was reduced to narrow down the error. Thanks again
I still can't see anything that would produce the ANR, but it is making it into the push delegate according to Sentry, so there isn't much I can do to make any suggestions.
My guess isn't that you're seeing the delegates called multiple times, it is the over amount of logging happening. Shiny already logs errors from push delegates. Sentry.Maui creates loggers that shiny can use.
What I will warn you about is that this code is trending down some unadvised paths. You've got sync locks in async methods, many try/catches which will be masking an end-to-end stack trace. OnEntry has a try catch, but then goes into the main thread, if it crashes there - you're try/catch can miss.
Beyond this, I need something definitive as in "here is the full c# stacktrace" or "here is the lines of causing issues".
There is still insufficient data here in terms of finding something I can fix, so this is being closed. You need to supply something that crashes as a repro. I copied portions of the supplied to https://github.com/shinyorg/pushtester and it worked without issue there.
Hi Allan,
Thank you so much for your help with removing the duplicate registration. It fixed the crash on the notification, which is greatly appreciated.
There are a few more minor issues identified in Sentry. I will try to find out the line numbers and post them when available.
Many thanks again.
Component/Nuget
Push - Native (Shiny.Push)
What operating system(s) are effected?
Version(s) of Operation Systems
iOS 17.5.1
Hosting Model
Steps To Reproduce
Use repositiory https://github.com/Yahya0007/Shiny-Push-Test WinForm app to send push notification. OnReceived is called multiple times and then app crashes.
This issue does not arise on Android. This issue has also not been reproduced when push is sent from Firebase Console.
Expected Behavior
OnReceived called without app crashing
Actual Behavior
App crashes after OnReceived is repeatedly called (approx 6, 7 times) and gives below;
2024-07-11 17:09:00.936 Xamarin.PreBuilt.iOS[570:48462] [Sentry] [debug] [SentryScope:125] Add breadcrumb: <SentryBreadcrumb: 0x302642480, { category = "Shiny.Hosting.IosLifecycleExecutor"; data = { eventId = LifecycleInfo; }; level = info; message = "Shiny.Push.PushManager handling lifecycle event for Shiny.Hosting.IIosLifecycle+INotificationHandler"; timestamp = "2024-07-11T16:09:00.935Z"; }>
Resolved pending breakpoint at 'PushDelegate.cs:77,1' to void PushDelegate.d10.MoveNext () [0x0002e].
Resolved pending breakpoint at 'PushDelegate.cs:84,1' to void PushDelegate.d 10.MoveNext () [0x000b3].
Resolved pending breakpoint at 'PushDelegate.cs:60,1' to void PushDelegate.d__10.MoveNext () [0x0000f].
2024-07-11 17:09:03.227 Xamarin.PreBuilt.iOS[570:48568] [Sentry] [warning] [SentryANRTracker:128] ANR detected.
2024-07-11 17:09:03.261 Xamarin.PreBuilt.iOS[570:48568] [Sentry] [debug] [SentryCrashStackCursor_SelfThread:65] Retrieving backtrace without async swift stitching... 2024-07-11 17:09:03.262 Xamarin.PreBuilt.iOS[570:48568] [Sentry] [debug] [SentryCrashStackCursor_SelfThread:78] Finished retrieving backtrace.
Thread started: #18
2024-07-11 17:09:04.673 Xamarin.PreBuilt.iOS[570:48462] [Sentry] [warning] [SentryANRTracker:92] ANR stopped.
2024-07-11 17:09:04.684 Xamarin.PreBuilt.iOS[570:48544] [Sentry] [debug] [SentryHttpTransport:274] sendAllCachedEnvelopes start.
2024-07-11 17:09:04.698 Xamarin.PreBuilt.iOS[570:48462] [Sentry] [debug] [SentryScope:125] Add breadcrumb: <SentryBreadcrumb: 0x302666e40, { category = "Shiny.Hosting.IosLifecycleExecutor"; data = { eventId = LifecycleInfo; }; level = info; message = "Shiny.Push.PushManager handling lifecycle event for Shiny.Hosting.IIosLifecycle+IRemoteNotifications"; timestamp = "2024-07-11T16:09:04.697Z"; }>
2024-07-11 17:09:04.674 Xamarin.PreBuilt.iOS[570:48544] [Sentry] [debug] [SentryFileManager:321] Writing envelope to path: /var/mobile/Containers/Data/Application/06D008C6-8494-4BDE-801B-EEB31F0CBF0F/Library/Caches/io.sentry/e09ac66d052c65891d6daf79cfa562aeba38d827/envelopes/1720714144.674033-00003-32002FE2-AAF0-468F-9D38-050FB64F063C.json
2024-07-11 17:09:04.668 Xamarin.PreBuilt.iOS[570:48462] [Sentry] [debug] [SentryScope:125] Add breadcrumb: <SentryBreadcrumb: 0x302647a80, { category = "Shiny.Hosting.IosLifecycleExecutor"; data = { eventId = LifecycleInfo; }; level = info; message = "Shiny.Push.PushManager handling lifecycle event for Shiny.Hosting.IIosLifecycle+INotificationHandler"; timestamp = "2024-07-11T16:09:04.665Z"; }>
2024-07-11 17:09:04.694 Xamarin.PreBuilt.iOS[570:48462] [Sentry] [debug] [SentryScope:125] Add breadcrumb: <SentryBreadcrumb: 0x302666dc0, { category = "Shiny.Hosting.IosLifecycleExecutor"; data = { eventId = LifecycleInfo; }; level = info; message = "Shiny.Push.PushManager handling lifecycle event for Shiny.Hosting.IIosLifecycle+IRemoteNotifications"; timestamp = "2024-07-11T16:09:04.693Z"; }>
The app has been terminated.
Exception or Log output
Below error is sometimes generated
System.NotSupportedException: Specified method is not supported. at Mono.Debugging.Evaluation.NamespaceValueReference.get_Type() in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NamespaceValueReference.cs:line 62 at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitInvocationExpression(InvocationExpressionSyntax node) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 833 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor #21
The app has been terminated.
1.Visit(SyntaxNode node) at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitMemberAccessExpression(MemberAccessExpressionSyntax node) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 979 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor
1.Visit(SyntaxNode node) at Mono.Debugging.Evaluation.ObjectValueAdaptor.GetExpressionValue(EvaluationContext ctx, String exp) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\ObjectValueAdaptor.cs:line 1418 System.NotSupportedException: Specified method is not supported. at Mono.Debugging.Evaluation.NamespaceValueReference.get_Type() in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NamespaceValueReference.cs:line 62 at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitInvocationExpression(InvocationExpressionSyntax node) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 833 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor1.Visit(SyntaxNode node) at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitMemberAccessExpression(MemberAccessExpressionSyntax node) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 979 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor
1.Visit(SyntaxNode node) at Mono.Debugging.Evaluation.ObjectValueAdaptor.GetExpressionValue(EvaluationContext ctx, String exp) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\ObjectValueAdaptor.cs:line 1418 System.NotSupportedException: Specified method is not supported. at Mono.Debugging.Evaluation.NamespaceValueReference.get_Type() in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NamespaceValueReference.cs:line 62 at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitInvocationExpression(InvocationExpressionSyntax node) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 833 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor1.Visit(SyntaxNode node) at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluatorVisitor.VisitMemberAccessExpression(MemberAccessExpressionSyntax node) in D:\a\_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\NRefactoryExpressionEvaluatorVisitor.cs:line 979 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor
1.Visit(SyntaxNode node) at Mono.Debugging.Evaluation.ObjectValueAdaptor.GetExpressionValue(EvaluationContext ctx, String exp) in D:\a_work\1\s\External\debugger-libs\Mono.Debugging\Mono.Debugging.Evaluation\ObjectValueAdaptor.cs:line 1418 Thread started:Code Sample
A winform app to send test notifications. https://github.com/Yahya0007/Shiny-Push-Test
On the app side there is only a return in OnReceived. A break point on return shows OnReceived is called six/seven times and then app crashes.
public class PushDelegate : IPushDelegate { public async Task OnReceived(PushNotification notification) { return; } }
Code of Conduct