Bug #94075 MySqlCommand.Cancel throws NullReferenceException
Submitted: 27 Jan 2019 1:26 Modified: 23 Sep 2022 15:43
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.0.14 OS:Windows (10)
Assigned to: CPU Architecture:Other (x64)

[27 Jan 2019 1:26] Bradley Grainger
Description:
Calling MySqlCommand.Cancel on a new MySqlCommand object throws a NullReferenceException.

How to repeat:
Run the following C# code:

	using (var cmd = new MySqlCommand())
		cmd.Cancel();

Suggested fix:
If there isn't an active command, the call to Cancel should be a no-op (and succeed without throwing an exception).
[27 Jan 2019 4:36] MySQL Verification Team
Hello Bradley,

Thank you for the report and test case.
Observed with VS 2017 (C#.Net) and Connector/NET 8.0.14 version.

regards,
Umesh
[8 Nov 2020 1:59] Bradley Grainger
This appears to be fixed in 8.0.22.
[23 Sep 2022 15:43] Omar Chavez
Posted by developer:
 
Could not reproduce the issue, verified using Connector/Net version 8.0.30