Reputation: 5729
I have a C# application who read in an SQL Server Database. Sometimes i get an error and the apps crash.
If i look on the EventViewer, i got this :
Application : XXXXXXXXX_CLI.EXE
Version du Framework : v4.0.30319
Description : le processus a été arrêté en raison d'une exception non gérée.
Informations sur l'exception : System.ComponentModel.Win32Exception
Informations sur l'exception : System.Data.SqlClient.SqlException
à System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean, System.Action`1<System.Action>)
à System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject, Boolean, Boolean)
à System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject, Boolean ByRef)
à System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
à System.Data.SqlClient.SqlDataReader.get_MetaData()
à System.Data.SqlClient.SqlCommand.FinishExecuteReader(System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.RunBehavior, System.String)
à System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, Boolean, Int32, System.Threading.Tasks.Task ByRef, Boolean, System.Data.SqlClient.SqlDataReader, Boolean)
à System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String, System.Threading.Tasks.TaskCompletionSource`1<System.Object>, Int32, System.Threading.Tasks.Task ByRef, Boolean)
à System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String)
à System.Data.SqlClient.SqlCommand.ExecuteReader(System.Data.CommandBehavior, System.String)
à System.Data.SqlClient.SqlCommand.ExecuteReader()
à XXXXXXXXX_CLI.Program._RG_1(System.String, System.String, System.String, System.Data.DataRow, System.String ByRef, System.String ByRef)
à XXXXXXXXX_CLI.Program._Fct_01(System.String)
à XXXXXXXXX_CLI.Program.Main(System.String[])
Is a connection problem ? or a parsing problem ( we can see :
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
)
Thanks a lot,
regards,
Upvotes: 5
Views: 12444
Reputation: 1
Had 2 days of work on this issue.
Everything was working for me on Development Environment but was throwing this exception on the Test Env.
I did two things at the same time, on the same pull request So I'm not too sure which one fixed this but you could check/resolve both.
My first guess on what fixed it, is that I've updated to the latest version of System.Data.SqlClient. Second, I had a .NetStandard 2.0 project in my solution. I've removed it.
Upvotes: 0