Bug #64092 MySqlCommand.CommandText equal to null
Submitted: 21 Jan 2012 14:29 Modified: 29 Feb 2012 21:15
Reporter: Сергей Петров Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.4.4 OS:Windows (Seven SP1)
Assigned to: Roberto Ezequiel Garcia Ballesteros CPU Architecture:Any

[21 Jan 2012 14:29] Сергей Петров
If MySqlCommand.CommandText equal to null, then MySqlCommand.ExecuteReader() throw NullReferenceException instead of InvalidOperationException.

How to repeat:
MySqlConnection connection=new MySqlConnection(@"<ConnectionString>");
new MySqlCommand(null,connection).ExecuteReader();

Suggested fix:
Do not allow MySqlCommand.CommandText to be null. Set it to empty string, when null is assigned.
[29 Feb 2012 21:15] John Russell
Added to changelog for 6.5.2: 

If MySqlCommand.CommandText was equal to null, then
MySqlCommand.ExecuteReader() would throw the wrong exception:
NullReferenceException instead of InvalidOperationException.
[12 Apr 2012 1:18] John Russell
Added to 6.3.9 changelog also.