Bug #15077 Error MySqlCommandBuilder.DeriveParameters for sp without parameters.
Submitted: 20 Nov 2005 6:28 Modified: 4 Sep 2006 14:02
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.7.30072 OS:Microsoft Windows (Windows xp)
Assigned to: Reggie Burnett CPU Architecture:Any

[20 Nov 2005 6:28] [ name withheld ]
Description:
My application crashes whe use MySqlCommandBuilder.DeriveParameters for stored procedures without parameters.
No problem when the sp has parameters.

How to repeat:
I use C# Express and MySqlClient for Net 2.0
The null exception (object no set an instance of object) occurs in StoredProcedure class at DiscoverParameters(MySqlCommand cmd, string procType) method.
[20 Nov 2005 8:39] Vasily Kishkin
Sorry...I was not able to reproduce the bug. Could you please create and attach your test case ?
[21 Nov 2005 14:09] [ name withheld ]
Ok, I make a little proyect to test and work fine.
The problem occurs in my real project that work with reomoting and so on.
I wil test  more to know whiy crashes there.
Thank You
[23 Nov 2005 12:43] Vasily Kishkin
I set status "Not a Bug". If you will be able to reproduce the bug on simple test case - please re-open this bug.
[23 Nov 2005 20:38] [ name withheld ]
Hi, I upload a test project to see this problem.
Than you!
Winxp
C# Express 2005
MySql 5.0
[23 Nov 2005 20:39] [ name withheld ]
C# express 2005 project

Attachment: TestProject.zip (application/x-zip-compressed, text), 36.93 KiB.

[1 Dec 2005 23:32] Vasily Kishkin
Thanks for test case. I'm sorry I missed that you work with .NET 2.0.
I was able to reproduce the bug.
[6 Dec 2005 9:38] Emma Middlebrook
I am experiencing this problem on .NET framework 1.1.

I have a stored procedure that will get all the values from a table and it takes 0 parameters. When I call DeriveParameters() an exception is thrown "object not set to instance". 

I'll create a test application for you to test with. Here's the sample of code that appears to be going wrong though.

public static MySqlParameter[] DiscoverSpParameterSet(MySqlConnection connection, string spName)
{
using (MySqlCommand cmd = new MySqlCommand(spName,connection))
{
cmd.CommandType = CommandType.StoredProcedure;
try
{
	MySqlCommandBuilder.DeriveParameters(cmd);
}
catch (Exception e)
{
	throw e;
}
			
MySqlParameter[] discoveredParameters = new MySqlParameter[cmd.Parameters.Count];
cmd.Parameters.CopyTo(discoveredParameters, 0);
return discoveredParameters;
}
}
[6 Dec 2005 9:53] Emma Middlebrook
I have a sample project that shows the problem on .NET framework 1.1.

If you would like the project, I can email it to you but I can't upload it to this bug report.

Do you know of a workaround for this problem that will allow us to continue with our respect projects?

regards,

Emma
[19 May 2006 13:40] 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/6633
[30 Aug 2006 19:35] Reggie Burnett
pushed to 1.0.8
[4 Sep 2006 14:02] MC Brown
A note has been added to the 1.0.8 changelog.