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
The SqlDbType enumeration value, 240, is invalid. #2555
Comments
Hey, Are you hitting this with EF7? Can you provide some code we can use to reproduce the issue? ~Rowan |
Hi, Not EF7, just pure SqlDataReader. Here is the code... public async Task Main(string[] args)
{
var constr = @"Data Source=.\SqlExpress;Initial Catalog=AdventureWorks;Integrated Security=True";
var query = @"
SELECT * FROM [AdventureWorks].[Person].[Person]
SELECT * FROM [AdventureWorks].[Person].[Address]
";
using (var connection = new SqlConnection(constr))
using (var command = new SqlCommand(query, connection))
{
command.Connection.Open();
var reader = await command.ExecuteReaderAsync();
while (await reader.ReadAsync())
{
}
await reader.NextResultAsync(); // Error happens here only on CoreClr
while (await reader.ReadAsync())
{
}
}
} "frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.Data": ""
}
},
"dnxcore50": {
"dependencies": {
"System.Data.SqlClient": "4.0.0-*",
"System.Console": "4.0.0-*",
"System.Collections": "4.0.10-*",
"System.Linq": "4.0.0-*",
"System.Threading": "4.0.10-*",
"Microsoft.CSharp": "4.0.0-*"
}
}
} |
Also this may help since it happens only after second public void Main(string[] args)
{
var constr = @"Data Source=.\SqlExpress;Initial Catalog=AdventureWorks;Integrated Security=True";
var query = @"
SELECT * FROM [AdventureWorks].[Person].[Person] -- okay
SELECT [ModifiedDate] FROM [AdventureWorks].[Person].[Address] -- okay
SELECT * FROM [AdventureWorks].[Person].[Address] -- error
";
using (var connection = new SqlConnection(constr))
using (var command = new SqlCommand(query, connection))
{
command.Connection.Open();
var reader = command.ExecuteReader();
while (reader.Read())
{
}
reader.NextResult();
while (reader.Read())
{
}
reader.NextResult();
while (reader.Read())
{
}
}
} |
@malekpour I've contacted the SQL Client team to take a look at this one. They aren't on GitHub, so I'll leave this issue open until we have confirmation from them that the issue is being tracked elsewhere. |
@dazinator the original issue from this bug was fixed a while back. Could you open a new issue for the SQL Client team on https://github.com/dotnet/corefx. |
@rowanmiller - I fixed a bug today in our implementation, where we wern't managing the liftetime of |
I had the same error, and when I add 'MultipleActiveResultSets=true' in my connection string, the error was disappeared. |
@tbluesky2012 that sounds like a SqlClient bug, can you open an issue with a code sample on https://github.com/dotnet/SqlClient? |
When current profile is dnxcore50 calling SqlDataReader.NextResult or NextResultAsync throws exception with following message:
Stack trace:
The text was updated successfully, but these errors were encountered: