You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting a MissingKeyException 1 is missing from previous value on update. Object type MyType, Key type System.Int32, Group key type System.String
This occurs using a SourceCache<MyType, int> when using Group.
I have a application that receives a updates of arrays of MyType which should replace the previous set of data.
The exception arises when the source data has duplicate keys that will be grouped into different groups.
I can solve the problem by removing duplicates using DistinctBy on the source data but I was expecting this to work without pre-filtering.
Here is a simplified program that exhibits the problem on DynamicData 7.4.1
class Program
{
static void Main(string[] args)
{
SourceCache<Mytype, int> cache = new(x => x.Key);
List<Mytype> listWithDuplicates = new()
{
new(1, "G1"),
new(1, "G2"),
};
cache
.Connect()
.Group(x => x.Grouping)
.Subscribe();
cache.Edit(x =>
{
x.AddOrUpdate(listWithDuplicates);
x.Clear();
x.AddOrUpdate(listWithDuplicates);
});
}
}
class Mytype
{
public Mytype(int key, string grouping)
{
Key = key;
Grouping = grouping;
}
public int Key { get; set; }
public string Grouping { get; set; }
public override string ToString() => $"{Key}, {Grouping}";
}
The text was updated successfully, but these errors were encountered:
I'm getting a MissingKeyException
1 is missing from previous value on update. Object type MyType, Key type System.Int32, Group key type System.String
This occurs using a SourceCache<MyType, int> when using Group.
I have a application that receives a updates of arrays of MyType which should replace the previous set of data.
The exception arises when the source data has duplicate keys that will be grouped into different groups.
I can solve the problem by removing duplicates using DistinctBy on the source data but I was expecting this to work without pre-filtering.
Here is a simplified program that exhibits the problem on DynamicData 7.4.1
The text was updated successfully, but these errors were encountered: