.NET versions of 6.9.9 and 6.10.3-rc seems to work well. But there is something fishy in .NET CORE / STANDARD versions of 6.10.3-rc and 8.0.9 dmr.
I got constantly errors:
Derived types must either match the security accessibility of the base type or be less accessible.
Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlCommand'.
Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlConnection'.
Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlDataReader'.
Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlException'.
Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlParameter'.
Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlParameterCollection'.
Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlClientFactory'.
Inheritance security rules violated by type: 'MySql.Data.MySqlClient.MySqlConnectionStringBuilder'.
To reproduce, here is a little sample program:
using System;
namespace ConsoleApp4
{
class Program
{
//Add first a reference to System.Data.Common.dll
static void Main(string[] args)
{
var pathToDll = @"C:\source\lib\netstandard1.3\MySql.Data.dll";
var assembly = System.Reflection.Assembly.LoadFrom(pathToDll);
try
{
//Crash:
var types = assembly.GetTypes();
}
catch (System.Reflection.ReflectionTypeLoadException e)
{
foreach(var ex in e.LoaderExceptions)
{
Console.WriteLine(ex.Message);
}
}
Console.ReadLine();
}
}
}
As said earlier, the previous versions don't have this error. But I would like to use .NET Standard / .NET Core.
I expect this is related to [assembly: AllowPartiallyTrustedCallers] and changed assembly.SecurityRuleSet.