Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

There is something fishy in Sandard/Core versions of MySQL.Data.dll (no replies)

$
0
0
.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.

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>