Bug #5801 Exception with duplicated server variables
Submitted: 29 Sep 2004 12:44 Modified: 13 Oct 2004 17:33
Reporter: Benjamin Arroyo Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.0 OS:Windows (Windows 2000 SP4)
Assigned to: Assigned Account CPU Architecture:Any

[29 Sep 2004 12:44] Benjamin Arroyo
Description:
Hashtable props crashes at InternalConnection class with duplicated server variables at function:

public void Configure(MySqlConnection connection)
{
	// load server properties
	Hashtable props = new Hashtable();
	MySqlCommand cmd = new MySqlCommand("SHOW VARIABLES", connection);

	try 
	{
		MySqlDataReader reader = cmd.ExecuteReader();
		while (reader.Read())
			props.Add( reader.GetValue(0), reader.GetValue(1) );
			
		reader.Close();
	}
	catch (Exception ex)
	{
		Logger.LogException( ex );
		throw ex;
	}

	[...]

How to repeat:
Having duplicated server variables by error.

Suggested fix:
Following code:

	while (reader.Read())
	{
		if ( !props.ContainsKey(reader.GetValue(0)) )
		{
			props.Add( reader.GetValue(0), reader.GetValue(1) );
		}
	}
[13 Oct 2004 17:33] Reggie Burnett
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in MySQL.

Additional info:

This has been reported several times and is fixed in the upcoming beta 2