Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV converters do not throw an exception when a field is not read #12

Open
martinkonopka opened this issue Jul 2, 2019 · 0 comments
Open

Comments

@martinkonopka
Copy link
Member

martinkonopka commented Jul 2, 2019

The CsvReader.TryGetField<T>() method is used for deserializing fields. If the field can not be deserialized (i.e., the value is empty, for example for numeric value), the method returns false. This can propagate in a CsvConverter further to a deserialization failure of the whole record. For example, here:
ValidationPointCsvConverter, line 33 (from the UXI.GazeToolkit Validation filter)

The CsvConverter.ReadCsv() should catch it, but it only checks if its own type is nullable, not the type of the field. Even when the ThrowOnFailedRead is set to true, the converter will not throw an exception, it will return default value (i.e., null).

This is in some cases expected, when we want to determine whether the record is really a null value - we distinguish it using non-nullable fields that are empty in the CSV. But ThrowOn* settings do not fully cover all possibilities of throwing exceptions on failed read.

Due to this issue, this test fails in UXI.GazeToolkit:
ValidationPointCsvReaderTest.ReadAll_MissingFieldInRecord_ThrowsException()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant