MySQL 8.3 Nuget Assemblies
Posted by: Tim Babcock
Date: February 14, 2024 11:22AM

After updating from MySQL 8.2 to 8.3, I updated the MySql.Data, MySql.Data.EntityFramework, and MySql.Web to 8.3.

Using the MySqlSessionStateStore.cs, an error appeared in the following section:

Unable to cast object of type 'System.Byte[]' to type 'System.String' under the following line of code:

Line 417: serializedItems = reader.GetString(1);

This error went away when 8.2 drivers were reloaded. No coding was changed on the app.

The code is used to change the MySqlSesssionStateStore since autocommit is turned off on the server.

The full code is found on

// Retrieve session item data from the data source.
reader = cmd.ExecuteReader(CommandBehavior.SingleRow);
while (reader.Read())
expires = reader.GetDateTime(0);

if (expires < DateTime.Now)
// The record was expired. Mark it as not locked.
locked = false;
// The session was expired. Mark the data for deletion.
deleteData = true;
foundRecord = true;

serializedItems = reader.GetString(1);
lockId = reader.GetInt32(2);
lockAge = DateTime.Now.Subtract(reader.GetDateTime(3));
actionFlags = (SessionStateActions)reader.GetInt32(4);
timeout = reader.GetInt32(5);

Options: ReplyQuote

Written By
MySQL 8.3 Nuget Assemblies
February 14, 2024 11:22AM
February 15, 2024 09:54AM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.