Bug #92734 MySqlParameter.Clone doesn't clone all properties
Submitted: 10 Oct 2018 15:45 Modified: 11 Oct 2018 4:00
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.0.12 OS:Microsoft Windows (10)
Assigned to: CPU Architecture:Other (x64)

[10 Oct 2018 15:45] Bradley Grainger
Description:
The MySqlParameter.Clone() method doesn't copy the values of the Size, Scale, Precision, IsNullable, and SourceColumnNullMapping properties to the cloned object.

How to repeat:
Execute the following C# code:

var parameter = new MySqlParameter
{
	Size = 1,
	Scale = 2,
	Precision = 3,
	IsNullable = true,
	SourceColumnNullMapping = true,
};

var clone = parameter.Clone();

Console.WriteLine(clone.Size); // prints 0, expected 1
Console.WriteLine(clone.Scale); // prints 0, expected 2
Console.WriteLine(clone.Precision); // prints 0, expected 3
Console.WriteLine(clone.IsNullable); // prints False, expected True
Console.WriteLine(clone.SourceColumnNullMapping); // prints False, expected True

Suggested fix:
Copy the values of these properties in Clone().
[11 Oct 2018 4:00] Umesh Shastry
Hello Bradley,

Thank you for the report and test case.
Observed this using VS 2017 and C/Net 8.0.12.

regards,
Umesh