-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
This issue is very similar to #520 , it happens on TransactionWrapper.UpdateData(IDocumentReference document, Dictionary<object, object> data)
Using code below, crate a document then update the document using TransactionWrapper.UpdateData, exception thrown on iOS, but no issue on android.
Thank you.
var db = CrossFirebaseFirestore.Current;
DateTimeOffset dateOnly = DateTimeOffset.Now;
var doc5 = db.GetCollection("zzz").GetDocument("doc5");
var data5 = new Dictionary<object, object>();
data5.Add("DateField", dateOnly);
data5.Add("FBFVField", FieldValue.ArrayUnion("Sub 1"));
await doc5.SetDataAsync(data5, SetOptions.Merge());
// Test 5: Working on Android, not working on iOS
var doc5 = db.GetCollection("zzz").GetDocument("doc5");
var data5 = new Dictionary<object, object>();
data5.Add("FBFVField2", FieldValue.ArrayUnion("Sub 2"));
data5.Add("DateField2", dateOnly);
bool IsSuccess = true;
await db.RunTransactionAsync<IFirestoreObject>(trans =>
{
try
{
_ = trans.UpdateData(doc5, data5);
}
catch (Exception ex)
{
ErrorLogger.Log(ex);
}
return null;
}).ContinueWith(async t =>
{
if (t.IsCompleted)
{
IsSuccess &= t.Status == TaskStatus.RanToCompletion;
if (!IsSuccess)
{
ErrorLogger.Log($"Transaction Failed! {t.Exception}");
}
}
});
<System.ArgumentException>: System.ArgumentException: Do not know how to marshal object of type 'Plugin.Firebase.Firestore.FieldValue' to an NSObject
at Foundation.NSArray.From[Object](Object[] items, Int64 count) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSArray.cs:line 161
at Foundation.NSArray.FromObjects(IntPtr count, Object[] items) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSArray.cs:line 144
at Foundation.NSDictionary`2[[Foundation.NSObject, Microsoft.iOS, Version=18.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065],[Foundation.NSObject, Microsoft.iOS, Version=18.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].FromObjectsAndKeys(Object[] objects, Object[] keys, IntPtr count) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSDictionary_2.cs:line 237
at Firebase.CloudFirestore.Transaction.UpdateData(Dictionary`2 fields, DocumentReference document)
at Plugin.Firebase.Firestore.Platforms.iOS.TransactionWrapper.UpdateData(IDocumentReference document, Dictionary`2 data)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working