-
Notifications
You must be signed in to change notification settings - Fork 293
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
5.2.0: using sqlConnection.FireInfoMessageEventOnUserErrors = true generates "Object reference not set to an instance of an object." exception #2388
Comments
We have the same problem. |
I have the same problem. When should we expect a release that we can use? |
hotfix release v5.2.1 release date yet TBD. |
Describe the bug
When using sqlConnection.FireInfoMessageEventOnUserErrors = true, a "print" sql command always throws an exception
Exception message:
Object reference not set to an instance of an object.
Stack trace:
at Microsoft.Data.SqlClient.SqlCommand.GetCurrentBatchCommand()
at Microsoft.Data.SqlClient.TdsParser.FireInfoMessageEvent(SqlConnection connection, SqlCommand command, TdsParserStateObject stateObj, SqlError error)
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite)
at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName)
at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at SqlClientBug.Program.Main(String[] args) in E:\NAS2\COBEMAR\2022\dotNet\SqlClientBug\Program.cs:line 31
To reproduce
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
Expected behavior
As in previous versions: no Exception
Further technical details
Microsoft.Data.SqlClient version: 5.2.0
.NET target: .NET 8.0
SQL Server version: SQL Server 2022
Operating system: Windows 11
Additional context
No problem when using Microsoft.Data.SqlClient version 5.1.5
The text was updated successfully, but these errors were encountered: