Unity editor version: 2018.4
Firebase Unity SDK version: 6.12
Firebase plugins in use (Auth, Database, etc.): FireStore
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?
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
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.