Quickstart-unity: [Minor?] Firestore Linq throw `InvalidCastException: Specified cast is not valid.`

Created on 10 Mar 2020  路  4Comments  路  Source: firebase/quickstart-unity

Please fill in the following fields:

Unity editor version: 2018.4
Firebase Unity SDK version: 6.12
Firebase plugins in use (Auth, Database, etc.): FireStore

Please describe the issue here:

QuerySnapshot implement IEnumerable<DocumentSnapshot> so I expect that it could iterate with itself directly. But it just throw exception

QuerySnapshot query = await fireStoreQuery.GetSnapShotAsync();
var docs0 = query.Documents.ToArray(); // fine
var docs1 = query.ToArray(); // throw exception

So should firebase fix this exception or remove the IEnumerable interface from this class?

Please answer the following, if applicable:

What's the issue repro rate?

100%

InvalidCastException: Specified cast is not valid.
(wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
Firebase.Firestore.QuerySnapshot.GetEnumerator () (at Z:/tmp/tmp.1TQduATzsL/firebase/firestore/client/unity/proxy/QuerySnapshot.cs:144)
Firebase.Firestore.QuerySnapshot.System.Collections.IEnumerable.GetEnumerator () (at Z:/tmp/tmp.1TQduATzsL/firebase/firestore/client/unity/proxy/QuerySnapshot.cs:149)
System.Linq.Enumerable+<OfTypeIterator>d__32`1[TResult].MoveNext () (at <fbb5ed17eb6e46c680000f8910ebb50c>:0)
System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) (at <fbb5ed17eb6e46c680000f8910ebb50c>:0)
System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <fbb5ed17eb6e46c680000f8910ebb50c>:0)
FirebaseManager+<TestFireStore>d__6.MoveNext () (at
bug

All 4 comments

Thanks for pointing this out. This is supposed to work :-). We'll reproduce and get a fix into an upcoming release, though I can't promise it's going to be the next one.

Update: we have fixed the issue and hope it would be a part of the next release. Thanks for reporting it!

Reopening until the release with the fix goes out.

The fix for this issue was released in the 6.13.0 release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

v-sag picture v-sag  路  6Comments

Ankit-Jegames picture Ankit-Jegames  路  3Comments

highpockets picture highpockets  路  5Comments

GeorgeFedoseev picture GeorgeFedoseev  路  3Comments

kantagara picture kantagara  路  5Comments