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

[Bug]: After GetInstance, calling All<T>().FirstOrDefault(); throws System.ArgumentOutOfRangeException #3092

Closed
winnicki opened this issue Nov 13, 2022 · 2 comments
Assignees
Labels
More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community

Comments

@winnicki
Copy link

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

  1. Run the app for the first time
  2. Quit the app and run again (LoginAsync hangs first time because of [Bug]: await LogInAsync(Credentials.Anonymous) always hangs the first time app runs #3090)
  3. 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

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

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Nov 14, 2022
@nirinchev
Copy link
Member

I can't reproduce this - I'm getting null for this. I'm running it on the iOS simulator on my mac - LMK if this only reproduces on a particular platform.

@nirinchev nirinchev added the More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. label Nov 14, 2022
@winnicki
Copy link
Author

Closing this as it's not a Realm bug.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Nov 16, 2022
@sync-by-unito sync-by-unito bot removed the Needs-Attention Reporter has responded. Review comment. label Nov 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community
Projects
None yet
Development

No branches or pull requests

2 participants