I have a public class `Entity` and an entity that inherits from that called `MongoEntity`.
The MongoEntity is an implementation detail of the repository, so it is used only internally and is not exposed outside.
e.g. something like this:
class Entity {} class MongoEntity : Entity {} public class Repository{ private IMongoCollection<MongoEntity> collection; public IQueryable<Entity> Entities { get => collection.AsQueryable(); } }
Until 2.18.0 it works fine, but it breaks with 2.19.0:
I get the following exception in my sample:
System.ArgumentException: 'ValueType 'ConsoleApp4.Program+MongoEntity' of parameterSerializer does not match parameter type 'ConsoleApp4.Program+Entity'. (Parameter 'parameterSerializer')'
In my real application I get the following error:
System.InvalidCastException: 'Unable to cast object of type 'MongoDB.Bson.Serialization.BsonClassMapSerializer`1[Notifo.Identity.MongoDb.MongoDbUser]' to type 'MongoDB.Bson.Serialization.IBsonSerializer`1[Microsoft.AspNetCore.Identity.IdentityUser]'.'
I was not able to reproduce this exception in my sample, but I guess it is the same root issue.
My very little example is attached.
- is duplicated by
-
CSHARP-4650 LINQ3 provider: ValueType 'X' of parameterSerializer does not match parameter type 'Y' (where X is a subclass of Y)
- Closed