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 MySqlConnection.Cancel #1506
MySqlConnector version: 2.3.1
Server type (MySQL, MariaDB, Aurora, etc.) and version: MariaDb
.NET version: 8.0.302
(Optional) ORM NuGet packages and versions: Pomelo.EntityFrameworkCore.MySql
Today I got this stacktrace on my server:
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at MySqlConnector.MySqlConnection.Cancel(ICancellableCommand command, Int32 commandId, Boolean isCancel) in /_/src/MySqlConnector/MySqlConnection.cs:line 762
at MySqlConnector.MySqlCommand.CancelCommandForTimeout() in /_/src/MySqlConnector/MySqlCommand.cs:line 439
at MySqlConnector.Utilities.TimerQueue.Callback(Object obj) in /_/src/MySqlConnector/Utilities/TimerQueue.cs:line 98
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
I noticed that back in 2022, there was a fix done for this exact issue:
However, this seems to be re-factored away and it seems like this bug was re-introduced at some point. 000f586 e82f091
The problem is that I don't know enough about the code-base to know whether adding null conditional operators is allowed, can someone give me some pointers?
Activity
bgrainger commentedon Aug 17, 2024
This does look like a bug that was reintroduced in e82f091; thanks for the analysis.
Fix potential NullReferenceException. Fixes #1506
dmathijs commentedon Aug 28, 2024
Thank you!
bgrainger commentedon Nov 12, 2024
Fixed in 2.4.0.