Description
Software versions
MySqlConnector version: 2.3.7
Server type (MySQL, MariaDB, Aurora, etc.) and version: MariaDb 10.6 and 10.11
.NET version: 8
(Optional) ORM NuGet packages and versions: no ORM
Describe the bug
I run the select queries with the parameterized and prepared commands. It runs several times without problem until at some point (it can happen after several minutes or hours) the error "Value cannot be null. (Parameter 'Data table may not be null.)".
If this is the case, the command can no longer be executed and returns the above error message.
The command somehow seems to be permanently "broken"
Other queries with non-parametrized commands can still be executed.
The only thing that helps at this point is reconnect.
The problem seems to be related to the switch to MySqlConnector 2.3.x and .NET 8.
Previously it worked stable with MySqlConnector 2.2.x and .NET 6 or even earlier with MySqlConnector 1.3.x and .NET Framework 4.7.2
Exception
"Specified argument was out of the range of valid values"
at MySqlConnector.Protocol.Payloads.ColumnDefinitionPayload.ReadNames() in /_/src/MySqlConnector/Protocol/Payloads/ColumnDefinitionPayload.cs:line 134
at MySqlConnector.Core.ResultSet.GetName(Int32 ordinal) in /_/src/MySqlConnector/Core/ResultSet.cs:line 288
at System.Data.ProviderBase.SchemaMapping.GenerateFieldNames(DataReaderContainer dataReader)
at System.Data.ProviderBase.SchemaMapping..ctor(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, Boolean keyInfo, SchemaType schemaType, String sourceTableName, Boolean gettingData, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.FillMapping(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
Code sample
var dataAdapter = new MySqlDataAdapter();
dataAdapter.SelectCommand = command; // prepared MySqlCommand with one or more MySqlParams
using (var dataSet = new DataSet())
{
dataAdapter.Fill(dataSet);
var dataTable = dataSet.Tables[0];
return dataTable;
}
Expected behavior
A stable version as in previous versions or at least a correct error message.