Bug #50344 MySqlScript.Execute() throws InvalidOperationException
Submitted: 14 Jan 2010 18:42 Modified: 19 Feb 2010 14:45
Reporter: Pavel Bazanov Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.2.2 OS:Any
Assigned to: CPU Architecture:Any
Tags: InvalidOperationException, mysqlscript, The CommandText property has not been properly initialized.

[14 Jan 2010 18:42] Pavel Bazanov
Description:
Hello,
Please take a look at the test case in the How to repeat section. Maybe I am doing something wrong?

Also, why there is no documentation for MySqlScript class?

How to repeat:
public void MySqlScriptTest_50344()
{
	MySqlConnection conn = CreateAndOpenConnection();
	StringBuilder sb = new StringBuilder();
	sb.AppendLine("DROP FUNCTION IF EXISTS `BlaBla`;");
	sb.AppendLine("DELIMITER ;;");
	MySqlScript script = new MySqlScript(conn, sb.ToString());
	script.Execute(); // InvalidOperationException : The CommandText property has not been properly initialized.
}
[15 Jan 2010 7:26] Tonci Grgin
Hi Pavel and thanks for new report.

Don't know what's wrong on a first look but there is a broad discussion regarding this in Bug#46429. See if it helps.
[17 Jan 2010 13:17] Pavel Bazanov
Hi Tonci, I read discussion in the Bug#46429, but I don't know if our bugs are related or not. Also exception are different, so maybe the reasons are different. I would debug the problem using the sources, but unfortunately I don't have much time now :(

PS. Do you have a public repository open for read? If no, then where can I get latest (not yet generally available) builds?
[18 Jan 2010 6:51] Tonci Grgin
Pavel, you can find everything on launchpad, https://launchpad.net/connectornet and https://code.launchpad.net/~mysql-clr-team/connectornet/trunk. Trunk always holds latest development code.
[18 Jan 2010 12:45] Pavel Bazanov
The bug can be reproduced with the latest sources (revision 821).
Also "Debug.Assert((buffer.Position + numbytes) < buffer.Length)" in MySqlPacket.ReadLong() fails and later an exception described above is thrown.
[22 Jan 2010 21:22] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/97941

788 Reggie Burnett	2010-01-22
      - fixed bug where a scipt that had an empty last line would cause an InvalidOperationException (bug #50344)
[22 Jan 2010 21:33] Reggie Burnett
Fixed in 6.0.6, 6.1.4, and 6.2.3
[22 Jan 2010 22:57] Pavel Bazanov
Are you going to create any documentation for MySqlScript class? I think you could at least start with a simple 1-page article in Connector documentation.
[25 Jan 2010 11:53] Tony Bedford
There is some documentation on MySqlScript in the reference manual included with the connector. However, we do some some documentation added to the main online docs too. I have created a new docs bug for this Bug #50586.

An entry has been added to the 6.0.6, 6.1.4, and 6.2.3 changelogs:

When the MySqlScript.execute() method was called, the following exception was generated:

InvalidOperationException : The CommandText property has not been properly initialized.
[19 Feb 2010 14:45] Pavel Bazanov
Thanks for fixing the bug. The tests now passes.