-
Type: Task
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
What happened?
After I use GetInstance, I try to get All<Folder>().FirstOrDefault(f => f.Name == "Root Folder"); and it throws a System.ArgumentOutOfRangeException. If I re-run the app it works, so I know it's because the data isn't synced, but if it's not synced yet then it should just return nothing, not throw an exception?
This and 2 other issues I logged tonight can all be easily reproduced in my Xamarin app once I give you access to the GH repo.
Repro steps
- Run the app for the first time
- Quit the app and run again (LoginAsync hangs first time because of https://github.com/realm/realm-dotnet/issues/3090)
- Put a breakpoint on line 78 in FolderClientService.GetRootFolder
Result: exception is thrown
Version
10.18.0
What SDK flavour are you using?
MongoDB Atlas (i.e. Sync, auth, functions)
What type of application is this?
Xamarin
Client OS and version
Xamarin.iOS running iOS 16
Code snippets
Search GetRootFolder in the solution.
Stacktrace of the exception/crash you're getting
Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: Get from RealmResults index:0 beyond range of:0 at Realms.NativeException.ThrowIfNecessary (System.Func`2[T,TResult] overrider) [0x0000a] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Native\NativeException.cs:88 at Realms.ResultsHandle.GetValueAtIndex (System.Int32 index, Realms.Realm realm) [0x00016] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Handles\ResultsHandle.cs:121 at Realms.RealmResultsVisitor.GetObjectAtIndex (System.Int32 index, Realms.ResultsHandle rh, System.String methodName) [0x00000] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Linq\RealmResultsVisitor.cs:631
Relevant log output
No response