Operation is not supported on this Platform

Hello,

I am using Unity 2020.3.8f1, Windows, and NetStandard 2.0. I am attempting to integrate NuGet Gallery | MySql.Data 9.0.0 into my project to store user data. However, whenever I attempt to establish a Connection to the database, I am hit with an error. The error is attached below.

System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.MySqlConfiguration' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.PlatformNotSupportedException: Operation is not supported on this platform.

According to the Website, MySQL.Data’s Nuget package support’s NetStandard 2.0.
I also attempted to switch the target to 4.x, but to no avail.

Any help would be appreciated!

I would recommend sticking with one of the Asset Store packaged-up SQL implementations if you’re trying to get it working under Unity. You might be able to wrestle the package above into submission but I have no idea where you’d even begin, because Unity is kind of a “special” .NET 2.0 implementation.

AFAIK no Unity Package Support’s MariaDB. How Special is Unity’s 2.0?

I’m not a big C# expert, but from my observations of our in-house platform team complaining ceaselessly about it for years and years, I would guess that on a scale of 0 to 255 is is probably in the 200s…

OTOH, no engine provides as much flexible instantaneous cross-platform value as Unity does, and that’s all I care about. :slight_smile:

Looks like MySqlConfiguration uses ConfigurationManager.GetSection(String) Method (System.Configuration) | Microsoft Learn
As far as I know Unity do not support ConfigurationManager. so I don’t believe MySQL.Data could be used in Unity.

Just realize that ConfigurationManager is not part of .NET Standard 2.0. Did you download it from Nuget too?
If not try to download it and add to the project.
I guess there are some chanse that it will replace loaded by unity dll (but I not sure ;))

1 Like

Thank you! Looks like Configuration Manager was outdated, a simple update fixed my issue!