Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Firebase crashlytics for Xamarin forms

$
0
0

Hi All,
I am implementing firebase crashlytics for xamarin forms project.
I want to log non-fatal exceptions for my iOS project. Below is the code I am using to log non-fatal exceptions.

PCL:

try
        {
            User objUser = null;
            string username=objUser.Username;
        }
        catch (Exception ex)
        {
             firebaseTracker.LogException(ex);
        }

IOS:

public void LogException(Exception exception)
{
var crashInfo = new Dictionary<object, object>
{
[NSError.LocalizedDescriptionKey] = exception.Message,
["StackTrace"] = exception.StackTrace
};

        var error = new NSError(new NSString(exception.GetType().FullName),
                                -1001,
                                NSDictionary.FromObjectsAndKeys(crashInfo.Values.ToArray(), crashInfo.Keys.ToArray(), crashInfo.Count));


        Device.BeginInvokeOnMainThread(() => {
            Crashlytics.SharedInstance.RecordError(error);

        });
    }

The code in PCL throws System.NullReferenceException: Object reference not set to an instance of an object.
Actual Result: This gets logged both under Crashes and Non-fatal section of firebase portal
Expected Result: This should get logged only under Non-fatal section of firebase portal

Note:[This is happening only for Null Reference exception. System.ArgumentOutOfRangeException gets logged only under non-fatal section(which is correct)]

Any help would be appreciated!

Thanks,
Payal


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>