TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
211 stars 49 forks source link

NullReferenceException #203

Open DavidShochet opened 12 months ago

DavidShochet commented 12 months ago

I followed the manual for using this plugin, and for some time it worked fine. In fact, it is still working in production. But some time ago we moved to .Net 7, and made various changes which are still in QA. And for some time we have not used Google Analytics. But now I began using it again, and realized that it does not work anymore.

            var sut = CrossFirebaseAnalytics.Current;

            sut.LogEvent(gaEvent, parameters);

LogEvent throws an exception:

System.NullReferenceException: Object reference not set to an instance of an object. Plugin.Firebase.Analytics.FirebaseAnalyticsImplementation.LogEvent(String eventName, IDictionary`2 parameters)

The parameters passed are not null.

This issue seems to exist only in Android.

Also, your manual for using the plugin with MAUI is obsolete. It is for .NET 6. If I update the Nuget package, it does not compile.

Please advise.

TobiasBuchholz commented 10 months ago

Hey and sorry for the late response. The sample and test projects of the plugin are now moved to .net7 and the tests are completing successfully on iOS and android, so I don't know why it's not working for you. Could you please provide a sample project that demonstrates this issue? Thanks!

lhughey commented 3 months ago

I'm having the same issue. One thing to note is that the documentation and tests are referencing CrossFirebaseSettings in the Android initialization, when the method signature has changed. The 2nd parameter of the initialization is now FirebaseOptions. I bring that up to draw light to the fact that the tests should not be passing (at least today).

I'd be happy to submit a PR if I can determine the fix.

AdamEssenmacher commented 3 months ago

https://github.com/TobiasBuchholz/Plugin.Firebase/blob/development/docs/analytics.md ?