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

[Question] Handling nullable value types #1223

Open
dri-richard opened this issue Mar 25, 2025 · 3 comments
Open

[Question] Handling nullable value types #1223

dri-richard opened this issue Mar 25, 2025 · 3 comments
Assignees
Labels
api: firestore needs-info Need information for the developer stale Don't have recent activity type: question

Comments

@dri-richard
Copy link

What is your question?

We're working with a customer who has a sizeable Firestore database, and we're developing new client software in Unity. Previously they used native SDKs.

The problem is that occasionally a document has a null value for e.g. a boolean field, and DocumentSnapshot.ConvertTo() raises an exception:

System.ArgumentException: Unable to convert null value to System.Boolean at Firebase.Firestore.ValueDeserializer.Deserialize (Firebase.Firestore.DeserializationContext context, Firebase.Firestore.FieldValueProxy value, System.Type targetType)

However, we're also not able to use nullable values, which produce this error:

System.NotSupportedException: Profile.newFlag is Nullable value type, which we do not support now due to a Unity limitation. Try using a reference type instead.

What are my options for handling this situation? Should I create a FirestoreConverter for any document type that I suspect may in future be affected? Or is there something else I could do?
thanks

Firebase Unity SDK Version

11.8.1

Unity editor version

2022.3.31f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

Firestore

Other Firebase Component(s) in use

Authentication, Crashlytics, DynamicLinks, Storage, Remote Config

Additional SDKs you are using

No response

Targeted Platform(s)

Apple Platforms

Unity editor platform

Mac

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@cherylEnkidu
Copy link

Hi @dri-richard , thank you for filling out this ticket! Could you please further explain your use case here by providing some code snippets?

@cherylEnkidu cherylEnkidu added the needs-info Need information for the developer label Mar 27, 2025
@google-oss-bot
Copy link

Hey @dri-richard. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot google-oss-bot added the stale Don't have recent activity label Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore needs-info Need information for the developer stale Don't have recent activity type: question
Projects
None yet
Development

No branches or pull requests

4 participants