The test Bad_data_error_handling_invalid_cast fails on Npgsql, which uses TypedRelationalValueBufferFactoryFactory instead of the default UntypedRelationalValueBufferFactoryFactory.
First, reading SupplierID (an integer) as a ProductName (a string) works, since Npgsql allows reading casting int fields to strings (i.e. when NpgsqlDataReader.GetString() is called). ProductName, which is read as SupplierID, would throw an exception except that in this test it's a navigation and so is never accessed. It's sufficient to switch around ProductName with UnitsInStock instead and an exception is generated.
However, the error isn't caught in EntityMaterializerSource.ThrowReadValueException and rethrown as the proper expected exception, since when TypedRelationalValueBufferFactoryFactory is used the exception is thrown earlier, when the ValueBuffer is constructed (QueryMethodProvider.cs:42) rather than when it is accessed from the shaper (QueryMethodProvider.cs:48).
The test
Bad_data_error_handling_invalid_castfails on Npgsql, which usesTypedRelationalValueBufferFactoryFactoryinstead of the defaultUntypedRelationalValueBufferFactoryFactory.First, reading
SupplierID(an integer) as aProductName(a string) works, since Npgsql allows reading casting int fields to strings (i.e. whenNpgsqlDataReader.GetString()is called).ProductName, which is read asSupplierID, would throw an exception except that in this test it's a navigation and so is never accessed. It's sufficient to switch aroundProductNamewithUnitsInStockinstead and an exception is generated.However, the error isn't caught in
EntityMaterializerSource.ThrowReadValueExceptionand rethrown as the proper expected exception, since whenTypedRelationalValueBufferFactoryFactoryis used the exception is thrown earlier, when the ValueBuffer is constructed (QueryMethodProvider.cs:42) rather than when it is accessed from the shaper (QueryMethodProvider.cs:48).