Replies: 2 comments
|
I don't know if this is exactly a problem with this Plugin, or more just a nuance stemming from the awkwardness in how the native Crashlytics SDK works with .NET. If it helps, here's how I do it for Android: using Firebase.Crashlytics;
public static class CrashlyticsExtensions
{
public static MauiAppBuilder UseCrashlytics(this MauiAppBuilder builder)
{
var crashlytics = FirebaseCrashlytics.Instance;
if (crashlytics != null!)
crashlytics.CrashlyticsCollectionEnabled = true;
AppDomain.CurrentDomain.UnhandledException += static (_, e)
=> RecordException(e.ExceptionObject as Exception);
TaskScheduler.UnobservedTaskException += static (_, e)
=> RecordException(e.Exception);
return builder;
static void RecordException(Exception? exception)
{
var crashlytics = FirebaseCrashlytics.Instance;
if (crashlytics == null! || exception == null)
return;
crashlytics.RecordException(Java.Lang.Throwable.FromException(exception));
}
}
} |
0 replies
|
Thanks for the answer. I'm not saying that it is the plugin issue. I'm just looking for help :D And the issue is not with the exception. It's that I can't set the custom keys for the exception the way I want them to be set. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I added Firebase Crashlytics to our project to collect crash data. It works and crashes are collected
I wanted to set some custom keys when crash happens, by adding event handler to AppDomain.CurrentDomain.UnhandledException and setting custom keys:
CrossFirebaseCrashlytics.Current?.SetCustomKeys(properties);Custom keys I wanted to add are some unique identifiers that will be needed for crash investigation and also stack trace from the managed c# code (since firebase logs the native stacktrace)
Unfortunately the custom keys are not being logged with the crash log:
Only when I added event handler here
AppDomain.CurrentDomain.FirstChanceException += CurrentDomainOnFirstChanceException;then the custom keys are added. The issue with this handler is that at first chance exception we don't have the stack trace for exception yet. So it doesn't really fits my needs.I attach the sample solution that I created to verify this behaviour on clean project.
Firebase_Test.zip
Any idea why custom keys wouldn't be logged when set on AppDomain.CurrentDomain.UnhandledException?
From the testing it would seem that I set the custom keys too late? But how /when should I set them then?
Any help will be highly appreciated.
All reactions