Hello there,
I am having a very strange issue using SQLClient library. We use dapper in our repository library to perform CRUD operations.
Every now and then the insert command fails which the famous 'Object Reference not set to an instance of a type'
But the problem is the call stack does not have any of our internal code. We have stepped into Dapper where the actual call is made to insert and it fails the odd time. It is not consistent and call the same step works again without any issue. We have spent
hours trying to track the issue but with no luck. We also turned on ETW for ado.net to see if there is anything useful or meaningful message to point to the actual issue but no luck. Would appreciate if anyone could give us some guidance on this
Call stack on the exception
at System.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, _SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1
completion, Int32 startRpc, Int32 startParam)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite,
Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior)
at Dapper.SqlMapper.<QueryImpl>d__125`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType)
at Emydex.iWAMS.FW.Persistence.DapperImp.DapperWrapper`1.<>c__DisplayClass5_1.<ExecuteInsert>b__0() in C:\DATA\Emydex-Dev\Repo\iWAMS\Main\FW\iWAMS.FW.Persistence\DapperImp\DapperWrapper.cs:line 104
Thanks
Sharad