Bug #60541 MySqlDbCommandBuilder.BuildCommands throws MySqlException : Query execution ...
Submitted: 18 Mar 2011 23:52 Modified: 11 Apr 2011 20:39
Reporter: Rami Abughazaleh Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.3.6 OS:Windows (7 64-bit)
Assigned to: Julio Casal CPU Architecture:Any

[18 Mar 2011 23:52] Rami Abughazaleh
Description:
Hi.

MySqlDbCommandBuilder.BuildCommands throws MySql.Data.MySqlClient.MySqlException : Query execution was interrupted.

MySqlDbCommandBuilder dbCommandBuilder = new MySqlDbCommandBuilder("Data Source=localhost;Initial Catalog=test1;User id=root;password=password");

dbCommandBuilder.BuildCommands(@"..\..\TestData\Test1.xsd");
//exception is thrown here

CREATE TABLE Table1 (PrimaryKeyAsString nvarchar(50) PRIMARY KEY);
CREATE TABLE Table2 (PrimaryKeyAsDate datetime PRIMARY KEY);

The exception occurs when querying Table2.

I used Visual Studio 2010 Premium to create the xsd from scratch.

It works without issues for SqlDbCommandBuilder.

Any ideas?

Thank you.

How to repeat:
1. Create a database "test1".
2. Create tables with sql from description.
3. Create xsd in Visual Studio 2010 Premium IDE from scratch
4. Run c# code from description

Suggested fix:
I expected the exception to not be thrown.
[18 Mar 2011 23:53] Rami Abughazaleh
Test1.xsd

Attachment: Test1.xsd (application/xml, text), 3.77 KiB.

[18 Mar 2011 23:53] Rami Abughazaleh
Test1.Designer.cs

Attachment: Test1.Designer.cs (text/plain), 51.27 KiB.

[18 Mar 2011 23:53] Rami Abughazaleh
Test1.xsc

Attachment: Test1.xsc (application/octet-stream, text), 361 bytes.

[18 Mar 2011 23:54] Rami Abughazaleh
Test1.xss

Attachment: Test1.xss (application/octet-stream, text), 1.03 KiB.

[18 Mar 2011 23:56] Rami Abughazaleh
MySql Server v5.5.8
[19 Mar 2011 0:22] Rami Abughazaleh
I actually think this is a bug specifically in ndbunit.
http://code.google.com/p/ndbunit/issues/detail?id=38
[19 Mar 2011 7:42] Santo Leto
Hello Rami,

Thank you for a problem report.
Please upload a simple VS project so that I can test this (you can include all project files to an archive, and upload the archive only).

Thank you for your cooperation.
[21 Mar 2011 0:46] Rami Abughazaleh
simple console application that can reproduce bug

Attachment: bug_60541.zip (application/empty, text), 145.93 KiB.

[21 Mar 2011 0:47] Rami Abughazaleh
I've attached a simple console application that can reproduce the bug.

This confirms that the bug is not in ndbunit.

Thank you.
[21 Mar 2011 0:52] Rami Abughazaleh
Windows 7 Ultimate x64
Visual Studio 2010 Premium
.Net 4
MySql 5.5.10
MySql Connector/Net 6.3.6
[21 Mar 2011 0:56] Rami Abughazaleh
I just found out that if sqlSelectCommand.Cancel(); is not called, then it works without errors.  ;)
[22 Mar 2011 20:40] Santo Leto
Thank you for uploading the project.

I saw the MySqlException:

D:\My Dropbox\mysql\mysql-code-examples\net\c#\win7\60541\ConsoleApplication1\Co
nsoleApplication1\bin\Release>ConsoleApplication1.exe

Unhandled Exception: MySql.Data.MySqlClient.MySqlException: Query execution was
interrupted
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& i
nsertedId)
   at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affected
Rows, Int32& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior
)
   at ConsoleApplication1.Program.GetSchemaTable(MySqlConnection sqlConnection,
MySqlCommand sqlSelectCommand) in D:\My Dropbox\mysql\mysql-code-examples\net\c#
\win7\60541\ConsoleApplication1\ConsoleApplication1\Program.cs:line 48
   at ConsoleApplication1.Program.Main(String[] args) in D:\My Dropbox\mysql\mys
ql-code-examples\net\c#\win7\60541\ConsoleApplication1\ConsoleApplication1\Progr
am.cs:line 32

While commenting sqlSelectCommand.Cancel(); I don't get any error:

D:\My Dropbox\mysql\mysql-code-examples\net\c#\win7\60541\ConsoleApplication1\Co
nsoleApplication1\bin\Release>ConsoleApplication1.exe
[23 Mar 2011 0:44] Rami Abughazaleh
From http://code.google.com/p/ndbunit/issues/detail?id=38

Comment 21 by project member sboh...@gmail.com, Mar 20

...
As you can see from the IDbCommand.Cancel() method reference docs (http://msdn.microsoft.com/en-us/library/system.data.idbcommand.cancel%28v=VS.80%29.aspx) .Cancel() is *not* supposed to throw if it cannot perform the requested cancellation.  Note the REMARKS section of the .NET ref docs ("...if there is a command in process, and the attempt to cancel fails, no exception is generated.")

... I think the right course of action is for the MySQL provider behavior to be modified by the MySQL folks to behave 'as expected' in the event .Cancel() cannot succeed (and simply fail silently vs. throwing).
[23 Mar 2011 18:19] Santo Leto
Thank you for a bug report.
Setting the status to "verified" as per previous comments.
[11 Apr 2011 20:39] Julio Casal
Fixed in versions 6.1.6, 6.2.5 and 6.3.7.