You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NullReferenceException in SNIPacket.ReadFromStreamAsync #2026
Sentry is reporting this issue a lot (below the exact stack trace). Can you help?
System.NullReferenceException: Object reference not set to an instance of an object.
?, in void SNIPacket.ReadFromStreamAsync(Stream stream, SNIAsyncCallback callback)
?, in uint SNITCPHandle.ReceiveAsync(ref SNIPacket packet)
?, in uint SNIMarsConnection.ReceiveAsync(ref SNIPacket packet)
?, in void SNIMarsConnection.HandleReceiveComplete(SNIPacket packet, uint sniErrorCode)
?, in void SNIPacket.ReadFromStreamAsync(Stream stream, SNIAsyncCallback callback)+(Task<int> t) => { }
File "Task.cs", line 2381, in void Task.ExecuteWithThreadLocal(ref Task currentTaskSlot, Thread threadPoolThread)
Object reference not set to an instance of an object
at System.Data.SqlClient.SNI.SNIPacket.WriteToStream (System.IO.Stream stream) [0x00000] in :0
at System.Data.SqlClient.SNI.SNITCPHandle.Send (System.Data.SqlClient.SNI.SNIPacket packet) [0x0000c] in :0
at System.Data.SqlClient.SNI.SNIMarsConnection.Send (System.Data.SqlClient.SNI.SNIPacket packet) [0x0000c] in :0
at System.Data.SqlClient.SNI.SNIMarsHandle.SendControlPacket (System.Data.SqlClient.SNI.SNISMUXFlags flags) [0x00034] in :0
at System.Data.SqlClient.SNI.SNIMarsHandle.Dispose () [0x00014] in :0
at System.Data.SqlClient.SNI.TdsParserStateObjectManaged.Dispose () [0x00052] in :0
at System.Data.SqlClient.TdsParserSessionPool.PutSession (System.Data.SqlClient.TdsParserStateObject session) [0x00020] in :0
at System.Data.SqlClient.TdsParser.PutSession (System.Data.SqlClient.TdsParserStateObject session) [0x00008] in :0
at System.Data.SqlClient.TdsParserStateObject.CloseSession () [0x0000c] in :0
at System.Data.SqlClient.SqlCommand.PutStateObject () [0x00011] in :0
at System.Data.SqlClient.SqlCommand.ReliablePutStateObject () [0x00000] in :0
at System.Data.SqlClient.SqlCommand.EndExecuteReader (System.IAsyncResult asyncResult) [0x00022] in :0
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <509dd36094194d04bf311b5a53d207f9>:0
System.NullReferenceException: Object reference not set to an instance of an object.
File "SNITcpHandle.cs", line 902, in uint SNITCPHandle.ReceiveAsync(ref SNIPacket packet)
packet.ReadFromStreamAsync(_stream);
File "SNIMarsConnection.cs", line 144, in uint SNIMarsConnection.ReceiveAsync(ref SNIPacket packet)
return response;
File "SNIMarsConnection.cs", line 342, in void SNIMarsConnection.HandleReceiveComplete(SNIPacket packet, uint sniErrorCode)
sniErrorCode = ReceiveAsync(ref packet);
File "Task.cs", line 2349, in void Task.ExecuteWithThreadLocal(ref Task currentTaskSlot, Thread threadPoolThread)
ExecutionContext.RunFromThreadPoolDispatchLoop(threadPoolThread, ec, s_ecCallback, this);
Activity
JRahnama commentedon May 1, 2023
@MahmudX can you provide more info and possibly a repro that could help us reproducing the issue?
JRahnama commentedon May 8, 2023
From the error message I could say this is similar to issue #422. Can you follow on that thread if you see similarity please.
SuperXCode commentedon Feb 11, 2024
The error is still there
Object reference not set to an instance of an object
at System.Data.SqlClient.SNI.SNIPacket.WriteToStream (System.IO.Stream stream) [0x00000] in :0
at System.Data.SqlClient.SNI.SNITCPHandle.Send (System.Data.SqlClient.SNI.SNIPacket packet) [0x0000c] in :0
at System.Data.SqlClient.SNI.SNIMarsConnection.Send (System.Data.SqlClient.SNI.SNIPacket packet) [0x0000c] in :0
at System.Data.SqlClient.SNI.SNIMarsHandle.SendControlPacket (System.Data.SqlClient.SNI.SNISMUXFlags flags) [0x00034] in :0
at System.Data.SqlClient.SNI.SNIMarsHandle.Dispose () [0x00014] in :0
at System.Data.SqlClient.SNI.TdsParserStateObjectManaged.Dispose () [0x00052] in :0
at System.Data.SqlClient.TdsParserSessionPool.PutSession (System.Data.SqlClient.TdsParserStateObject session) [0x00020] in :0
at System.Data.SqlClient.TdsParser.PutSession (System.Data.SqlClient.TdsParserStateObject session) [0x00008] in :0
at System.Data.SqlClient.TdsParserStateObject.CloseSession () [0x0000c] in :0
at System.Data.SqlClient.SqlCommand.PutStateObject () [0x00011] in :0
at System.Data.SqlClient.SqlCommand.ReliablePutStateObject () [0x00000] in :0
at System.Data.SqlClient.SqlCommand.EndExecuteReader (System.IAsyncResult asyncResult) [0x00022] in :0
at System.Threading.Tasks.TaskFactory
1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <509dd36094194d04bf311b5a53d207f9>:0David-Engel commentedon Jun 15, 2024
We don't support SDS in this repo. If it can be repro'd in MDS, please file an issue.
johnwc commentedon Sep 21, 2024
We are seeing this in our logging as well. What is causing it? @David-Engel what does SDS and MDS stand for?
johnwc commentedon Sep 21, 2024
The stack trace from Entity Framework 8.0.8.
JRahnama commentedon Sep 21, 2024
SDS: System.Data.SqlClient
MDS: Microsoft.Data.SqlClient