-
Notifications
You must be signed in to change notification settings - Fork 254
Description
original class
public class Car
{
public int Id { get; init; }
[Column(TypeName = "jsonb")] public ImmutableHashSet<string> Windows { get; init; }
[Column(TypeName = "jsonb")] public ImmutableHashSet<Wheel> Wheels { get; init; }
[Column(TypeName = "jsonb")] public ImmutableList<Door> Doors { get; init; }
[Column(TypeName = "jsonb")] public ImmutableList<string> Stickers { get; init; }
}
After updating our code base to .NET 10 we bumped into some build time errors in regards of the [Column(TypeName = "jsonb")] ImmutableHashset<string> Windows.
Error :
The exception 'The type 'ImmutableHashSet<string>' cannot be used as a primitive collection because it is not an array and does not implement 'IList<string>'
We tried to change these ImmutableHashSet<string> to List<string>, after this changes we could run the app again. But when we inserted a row in the database with a [Column(TypeName = "jsonb")] ImmutableList<string> our application crashed.
Error:
No parameterless constructor defined for type 'System.Collections.Immutable.ImmutableList1'[System.String]'.
After not using the attribute anymore as it is deprecated, we declared our columns as jsonb in the DbContext. These runs without any problems but the data saved in the database only saves the 'capacity' property of the List {"Capacity": 2}
I created a POC of how our code is setup with different branches for each problem we bumped into: (explanation of the branches in the readme)
https://github.com/pimeggermont/poc_dotnet10
An example of all the different data inserted in the database for each possible attempt

Is this intended or regression?
Looking forward to your reply!