Description:
System.FormatException is generated when invoking a stored procedure that is defined with an IN parameter of ENUM type. The error occurs regardless of whether the input parameter is a string or an integer data type.
One possible workaround for affected users is to redefine the stored procedure to use a different data type for the IN paramter.
The stack trace is below:
MySql.Data.MySqlClient.Tests.Csc12029Tests.ProcEnumParamTest : System.FormatException : Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Byte.Parse(String s, NumberStyles style, NumberFormatInfo info)
at System.Byte.Parse(String s)
at MySql.Data.MySqlClient.ISSchemaProvider.ParseType(String type, String sql_mode, DataRow parmRow) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\ISSchemaProvider.cs:line 537
at MySql.Data.MySqlClient.ISSchemaProvider.ParseParameter(String parmDef, ContextString cs, String sqlMode, DataRow parmRow) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\ISSchemaProvider.cs:line 488
at MySql.Data.MySqlClient.ISSchemaProvider.ParseProcedureBody(DataTable parametersTable, String body, DataRow row, String nameToRestrict) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\ISSchemaProvider.cs:line 441
at MySql.Data.MySqlClient.ISSchemaProvider.GetParametersFromShowCreate(DataTable parametersTable, String[] restrictions, DataTable routines) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\ISSchemaProvider.cs:line 364
at MySql.Data.MySqlClient.ISSchemaProvider.GetProcedureParameters(String[] restrictions, DataTable routines) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\ISSchemaProvider.cs:line 219
at MySql.Data.MySqlClient.ProcedureCache.GetProcData(MySqlConnection connection, String spName) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\ProcedureCache.cs:line 120
at MySql.Data.MySqlClient.ProcedureCache.AddNew(MySqlConnection connection, String spName) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\ProcedureCache.cs:line 79
at MySql.Data.MySqlClient.ProcedureCache.GetProcedure(MySqlConnection conn, String spName) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\ProcedureCache.cs:line 61
at MySql.Data.MySqlClient.StoredProcedure.ProcessCommandText() in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\StoredProcedure.cs:line 73
at MySql.Data.MySqlClient.StoredProcedure.get_ProcessedCommandText() in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\StoredProcedure.cs:line 61
at MySql.Data.MySqlClient.Statement.BindParameters() in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\Statement.cs:line 80
at MySql.Data.MySqlClient.Statement.Execute(MySqlParameterCollection parameters) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\Statement.cs:line 62
at MySql.Data.MySqlClient.PreparableStatement.Execute(MySqlParameterCollection parameters) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\PreparableStatement.cs:line 94
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\command.cs:line 373
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader() in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\mysqlclient\command.cs:line 312
at MySql.Data.MySqlClient.Tests.Csc12029Tests.ProcEnumParamTest() in C:\Program Files\MySQL\MySQL Connector Net 5.0.1\Source\TestSuite\Csc12029.cs:line 97
How to repeat:
Test case attached.
Create a procedure with an ENUM IN parameter. Try to invoke this stored procedure using Connector/NET 5.0.1-beta.
Suggested fix:
Eliminate System.FormatException when using ENUM input parameters.