Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException in FirebaseAuthGoogleImplementation.HandleActivityResultAsync #400

Open
Dreamescaper opened this issue Jan 19, 2025 · 0 comments

Comments

@Dreamescaper
Copy link

Dreamescaper commented Jan 19, 2025

The suggested DI setup for Google Auth is the following:

        builder.Services.AddSingleton(_ => CrossFirebaseAuthGoogle.Current);

Meaning that this service is lazy, not created until requested.
However, that leads to a failure in FirebaseAuthGoogleImplementation.HandleActivityResultAsync if IFirebaseAuthGoogle wasn't ever requested.

So in my case, OnActivityResult is invoked for reasons not related to Google Auth. FirebaseAuthGoogleImplementation.HandleActivityResultAsync should simply do nothing. But because FirebaseAuthGoogleImplementation._googleAuth is null, it fails with NRE.

I was able to workaround that be replacing DI setup with this:

builder.Services.AddSingleton(CrossFirebaseAuthGoogle.Current);

In this case, FirebaseAuthGoogleImplementation is initialized on startup, and therefore doesn't fail. However, that probable negatively affects startup performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant