diff --git a/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs b/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs index b4cfb0938a5..48808848457 100644 --- a/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs +++ b/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs @@ -156,7 +156,7 @@ private SqlExpression ApplyTypeMappingOnSqlBinary( case ExpressionType.Coalesce: { inferredTypeMapping = typeMapping ?? ExpressionExtensions.InferTypeMapping(left, right); - resultType = inferredTypeMapping?.ClrType ?? left.Type; + resultType = inferredTypeMapping?.ClrType ?? (left.Type != typeof(object) ? left.Type : right.Type); resultTypeMapping = inferredTypeMapping; break; }