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
Dynamic type parameters: Cannot cast System.Int32 into any valid DbType after upgrading from 2.0.14.3 to 2.1.2.0 #201
Comments
Hmmmmm, thus isn't right. It should work. Do you think it would be possible to get how dapper is setting the parameter value? I never used dapper but I will try to set it up so I can try to reproduce this problem. |
Hi, Thanks for getting back to me. I have attached a very simple console app that repro's this issue (you only need to put in your own connection string and any valid table name inside Program.cs). If you change the reference to use the version of npgsql inside the included "original_working_lib" folder you will see the same code works fine (2.0.14.3). You can download the sample app from here: http://www.bitdiff.com/npgsqlbugdemo.zip Thanks for taking a look. Gav |
Hi, @glenebob , I noticed that this problem is caused by the fact that when setting a parameter value, Npgsql tries to check the type of the parameter. This code is having problem in the following line:
It seems that the NpgsqlTypesHelper.TryGetBackendTypeInfo isn't finding the corresponding typeinfo. This name is text_nonbinary. I notice that when you set the dbtype of the parameter to DbType.Object, Npgsql is setting the typeinfo to a type called text_nonbinary:
which doesn't have a correspondence in the backend type info and thus it is throwing the exception. Can you, please, talk more about this text_nonbinary mapping? Thanks in advance. |
I can do that this weekend. I'll be working in Npgsql a little. I need -Glen On Fri, Apr 4, 2014 at 12:57 PM, Francisco Figueiredo Jr. <
|
Great! I'm also investigating the #146 |
Here is a bunch of test cases: |
Fixed by #230 . |
Hi,
After upgrading to 2.1.2.0 I am getting an error "Can't cast System.Int32 into any valid DbType." originating from the setter "public override Object Value" within NpgsqlParameter.cs.
I am using dapper.net and I have calls like this:
This is stripped-down so doesn't necessarily make sense in this context, but I can fix it if I change
to
Is the previous method supported? I just wanted to make sure this is by-design before I go about changing all the places where this is used. I have confirmed that in 2.0.14.3 this code works 100%.
Kind Regards,
Gav
The text was updated successfully, but these errors were encountered: