We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Info message event is broken by version upgrade from 5.1.5 to 5.2.0
Exception message: System.NullReferenceException: '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 ConsoleApp1.Program.Main(String[] args) in C:\Users\Master\source\repos\Example1\ConsoleApp1\Program.cs:line 19
Complete code:
using Microsoft.Data.SqlClient; namespace ConsoleApp1 { internal class Program { static void Main(string[] args) { using (SqlConnection sqlConnection = new SqlConnection("integrated security=true; encrypt=false")) { sqlConnection.InfoMessage += (s, e) => { Console.WriteLine(e.Message); }; sqlConnection.FireInfoMessageEventOnUserErrors = true; sqlConnection.Open(); using (SqlCommand c = new SqlCommand("backup database master", sqlConnection)) { c.ExecuteNonQuery(); } } } } }
Info message to be fired instead of Exception.
Microsoft.Data.SqlClient version: (5.2.0) .NET target: (Core 8, 4.6.2, 4.8) SQL Server version: Operating system: Windows
The text was updated successfully, but these errors were encountered:
Duplicate of #2388
Sorry, something went wrong.
@h17117 This issue was fixed on PR #2399. This fix will be included in Hotfix 5.2.1 which released date is yet to be determined.
Closing as duplicate of #2388. Issue is addressed on PR #2399
No branches or pull requests
Describe the bug
Info message event is broken by version upgrade from 5.1.5 to 5.2.0
To reproduce
Complete code:
Expected behavior
Info message to be fired instead of Exception.
Further technical details
Microsoft.Data.SqlClient version: (5.2.0)
.NET target: (Core 8, 4.6.2, 4.8)
SQL Server version:
Operating system: Windows
The text was updated successfully, but these errors were encountered: