[Question] Handling nullable value types #1223
Labels
api: firestore
needs-info
Need information for the developer
stale
Don't have recent activity
type: question
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
The text was updated successfully, but these errors were encountered: