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've upgraded to Npgsql 8 and started getting this:
System.InvalidOperationException: No coercion operator is defined between types 'System.IO.MemoryStream' and 'System.Nullable`1[System.Text.Json.JsonElement]'.
at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.ShaperProcessingExpressionVisitor.CreateGetValueExpression(ParameterExpression dbDataReader, Int32 index, Boolean nullable, RelationalTypeMapping typeMapping, Type type, IPropertyBase property)
In Program.cs I have added:
staticProgram(){
#pragma warning disable CS0618// Type or member is obsolete// https://www.npgsql.org/doc/release-notes/8.0.html#json-poco-and-other-dynamic-features-now-require-an-explicit-opt-inNpgsqlConnection.GlobalTypeMapper.EnableDynamicJson();
#pragma warning restore CS0618// Type or member is obsolete}
But the error persists. I'll try and do a minimal reproducible example, but for now I believe it's this POCO causing grief:
publicsealedclass[ ...elided...]{[UsedImplicitly]public Guid Id {get;init;}publicstringCode{get;set;}=default!;publicJsonElement?InnerError{get;set;}publicstringMessage{get;set;}=default!;publicstring?Target{get;set;}}
Npgsql 7.x does not have this error.
dnetguru, ptlthg, cschulznethaus, Pinacolada8, cschulzsuper and 2 more