Skip to content

Test: FromSql error handling not compatible with TypedRelationalValueBufferFactoryFactory #6563

@roji

Description

@roji

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).

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions