NullReferenceException using a stored procedure with a UUID input parameter
elandev opened this issue · comments
Describe the bug
Getting a NullReferenceException with a stored procedure inserting into UUID column data type. I get the following NullReferenceException:
The stored procedure works, when I remove the UUID parameter from the stored procedure.
Object reference not set to an instance of an object.
at MySqlConnector.Core.CachedParameter..ctor(Int32 ordinalPosition, String mode, String name, String dataType, Boolean unsigned, Int32 length)
at MySqlConnector.Core.CachedProcedure.<FillAsync>d__0.MoveNext()
at MySqlConnector.MySqlConnection.<GetCachedProcedure>d__87.MoveNext()
at MySqlConnector.MySqlCommandBuilder.<DeriveParametersAsync>d__3.MoveNext()
at MySqlConnector.MySqlCommandBuilder.DeriveParameters(MySqlCommand command)
at Insight.Database.Providers.MySqlConnector.MySqlConnectorInsightDbProvider.DeriveParametersFromStoredProcedure(IDbCommand command)
at Insight.Database.Providers.InsightDbProvider.<>c__DisplayClass13_0.<DeriveParameters>b__0(IDbConnection _)
at Insight.Database.DBConnectionExtensions.ExecuteAndAutoClose[T](IDbConnection connection, Func`2 getCommand, Func`3 translate, CommandBehavior commandBehavior)
at Insight.Database.Providers.InsightDbProvider.DeriveParameters(IDbCommand command)
at Insight.Database.CodeGenerator.DbParameterGenerator.CreateClassInputParameterGenerator(IDbCommand command, Type type)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Insight.Database.DBCommandExtensions.AddParameters(IDbCommand cmd, Object parameters)
at Insight.Database.DBConnectionExtensions.CreateCommand(IDbConnection connection, String sql, Object parameters, CommandType commandType, Nullable`1 commandTimeout, IDbTransaction transaction)
at Insight.Database.DBConnectionExtensions.<>c__DisplayClass0_0.<ExecuteAsync>b__0(IDbConnection c)
at Insight.Database.DBConnectionExtensions.<ExecuteAsyncAndAutoClose>d__36`1.MoveNext()
at TestMySql.Program.<InsertSqlData>d__4.MoveNext() in C:\Dev\src\Scratch\TestMySqlUuid\Program.cs:line 107
Steps to reproduce
- Load the attached project with Visual Studio 2022.
- Set up MariaDB as the database (10.11.2-MariaDB).
- Edit the server, database name and credentials for the connection string.
- Restore Nuget packages and build the solution.
- Run the project.
The project is set up to run both tests with and without the UUID parameter. SQL insert statement works. Stored procedure works without UUID, but get the NullReferenceException when using the stored procedure with the UUID parameter.
Expected behavior
Expected the stored procedure insert with the UUID to work.
- Dotnet version: 6.0
- Database: 10.11.2-MariaDB
- Library version: Insight 6.3.11
TestMySqlUuid.zip
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue still exists. Is there an update on this?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Unfortunately, we can't accept project zip files as reproduction cases. Please paste sufficient code to reproduce here, or submit a PR with a failing test case.