I just stumbled over this - I registered my Records which include some ImmutableLists.
Basically, like this:
record A {
[BsonId]
string Id {get; init;}
string Name {get; init;}
ImmutableList<string> Properties {get; init;}
};
record B {
[BsonId]
string Id {get; init;}
string Name {get; init;}
ImmutableList<A> Members {get; init;}
}
Now, serializing those to my MongoDB works fine, everything looks like it should. However, the deserialization back in to the Records does not work, from the exception thrown it seems that the Add method does not quite work the way the deserializer expects (well, sure, instead of adding to the list itself it instead returns a new list with the added item).
Now, I found how to write a basic deserializer myself - but the nested A in B makes it a bit painful and it's quite brittle (e.g. if I later add additional nullable fields). What would be the best way to approach this problem?