Fatal Exception: UnityEngine.Application.CallLogCallback(UnityEngine.Application)

Can anyone please explain me how to fix a crash, that Crashlytics by Firebase is reporting:

Fatal Exception: java.lang.Exception: NullReferenceException : Object reference not set to an instance of an object.
at UnityEngine.Application.CallLogCallback(UnityEngine.Application)

I am using Unity 2020.3.20f1, Firebase 11.5.0.


Up

How are you using that method, there are no known bugs with Application.CallLogCallback.

Also Unity 2020.x is no longer supported, you might want to switch to supported Unity LTS version.

The thing is, I don’t use this method at all. Debug.Log or Debug.LogWarning only.

It’s used by this API - Unity - Scripting API: Application.LogCallback

Ok i found something in the third-party sdk (Appmetrica).

There is a reference to “Instance” in the HandleLog method, probably here is the reason of crashes.9412193--1318217--upload_2023-10-16_17-30-36.png

You could an extra check here

if (Instance == null)
   return;

maybe that will help.

Got it, thanks!

Is there a way I could get the Exception object from a Debug.LogException from a callback like Application.logMessageReceived without creating a custom ILogHandler that is a wrapper ontop of the DefaultLogHandler that in the end will add a new entry in the callstack of the LogException? Some type of exceptions like FirebaseException have an ErrorCode field that is not added to their Message and I would need the access to it to manualy log it.