Bug #42689 System.NullReferenceException: Object reference not set to an instance of an obj
Submitted: 9 Feb 2009 11:39 Modified: 11 Feb 2009 18:14
Reporter: Farhan Ali Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Administrator Severity:S2 (Serious)
Version:My Sql Client Version 5.1.11 OS:Linux
Assigned to: CPU Architecture:Any
Tags: object reference

[9 Feb 2009 11:39] Farhan Ali
Description:
I have following in C#
  
if (conn.State != ConnectionState.Open)
                    conn.Open();
                MySqlCommand comm = new MySqlCommand(query, conn);
                comm.CommandTimeout = 120;
                
                int res = comm.ExecuteNonQuery();
                conn.Close();

when i execute this command,sometimes i got this error
"System.NullReferenceException: Object reference not set to an instance of an object.
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()"

i know ExecuteNonQuery() internally calls data reader is there any way to close this?

How to repeat:
executing this code will produce this error

  if (conn.State != ConnectionState.Open)
                    conn.Open();
                MySqlCommand comm = new MySqlCommand(query, conn);
                comm.CommandTimeout = 120;
                
                int res = comm.ExecuteNonQuery();
                conn.Close();
[11 Feb 2009 18:14] Susanne Ebrecht
Many thanks for writing a bug report.
We are on the way to implement the whole functionality of MySQL Administrator into MySQL Workbench.
Unfortunately you are using an unsupported platform.

For more details about supported platforms please read here:

http://www.mysql.com/support/supportedplatforms/tools.html