-
Notifications
You must be signed in to change notification settings - Fork 53
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
Issue with writing Lists to Firestore (only on Android) #392
Comments
@TobiasBuchholz @AdamEssenmacher , would you have an opinion on how I can troubleshoot this issue please? |
@cagriy can you try cloning the repo and step through a scenario with a debugger? It sounds like there might be a bug somewhere when the plugin is translating from pure .NET types to .NET for Android types used by the native platform SDK. |
Hi @AdamEssenmacher , I debugged as suggested, and the problem seems to be here: Here I am writing a list of 7 elements (DateTimeOffset), iteration works as expected and
I changed it as above and monitored newItem in all seven operations, it was fine. But the list stopped growing after one or two iterations. Out of curiosity, I changed this function to:
It then started adding all seven elements consistently. I am not suggesting this as a fix, but it may give us a clue. Essentially, JavaList calls the same Add method in its constructor. If there is a genuine reason for the latter to work, I can PR it. Please let me know what the best way to proceed is. |
I was about to tell you that I couldn't reproduce based on your original sample code If you update your original sample to
The Android .NET So I took a look at the Android.Runtime code itself... and sure enough: For whatever reason, the What's incredible about this is that the offending code has been there since at least when Xamarin went open source in 2016! I'll open an issue at dotnet/android. In the meantime, for this plugin, the alternative solution you found seems like a good enough workaround. I'd probably leave a comment behind with a link back to this issue and a short explanation. |
For clarification, I was testing with seven identical DateTimeOffsets yesterday, and I was typically getting one or two elements, on a single occasion, three. |
This is to avoid an issue in dotnet/android that is resulting in incosistent behaviour when a List has duplicate items. TobiasBuchholz#392
@TobiasBuchholz , I apologise for my impatience. Would it be possible to have this one merged / released, if possible at all? |
No worries, the new version is out now! 🚀 ✌ |
Please note there was a similar issue in the past, I cannot tell of this was related: #276
Versions:
Plugin.Firebase.Firestore: 3.1.0
AdamE.Firebase.iOS.Installations: 10.29.0.1
Object definition:
I then run
On IOS, the array (list) gets written to FireStore correctly, on Android, it creates an array with a single element, using the first item.
Please let me know if there is anything else I can provide to help.
The text was updated successfully, but these errors were encountered: