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

Binary column errors out with InvalidCastException #33

Open
JeffHenson opened this issue Jul 3, 2018 · 2 comments
Open

Binary column errors out with InvalidCastException #33

JeffHenson opened this issue Jul 3, 2018 · 2 comments

Comments

@JeffHenson
Copy link

JeffHenson commented Jul 3, 2018

When trying to read a binary column, sometimes it errors out when accessing it from the DbDataReader. I say sometimes because when the declaredColumnTypes variable in the NuoDbDataReader is not set it doesn't error out.

If it helps, here's a small program that reproduces the issue: https://gist.github.com/JeffHenson/17b95e5b12f5428ebe26618a06901d97

This was tested with commit e5823eb.

@albymassari
Copy link
Contributor

The reason for the failure is that, when the declaredColumnTypes are available, the value returned for a column is converted into that type. For the VARBINARY column, this type is BLOB, that is mapped into a .Net type of System.Object. But the returned byte[] value can't be converted into a generic Object, so the exception is thrown. We'll look into fixing this mapping.

@gtbX
Copy link

gtbX commented Feb 27, 2020

Is there a suggested workaround for this?

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

3 participants