SapientGuardian / mysql-connector-net-netstandard

ADO.NET driver for MySQL targeted against netstandard 1.3
GNU General Public License v2.0
46 stars 15 forks source link

MethodAccessException using library from .net 4.6.1 console app #11

Closed SapientGuardian closed 8 years ago

SapientGuardian commented 8 years ago
Exception thrown: 'System.MethodAccessException' in SapientGuardian.MySql.Data.dll

Additional information: Attempt by security transparent method 'MySql.Data.Common.MyNetworkStream.CreateSocketStream(MySql.Data.MySqlClient.MySqlConnectionStringBuilder, System.Net.IPAddress, Boolean)' to access security critical method 'System.Net.Sockets.SocketTaskExtensions.ConnectAsync(System.Net.Sockets.Socket, System.Net.EndPoint)' failed.

Assembly 'SapientGuardian.MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=null' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model.  Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
eByte23 commented 8 years ago

@SapientGuardian This could be could be to do with how the Connection is being made, its creating the connection async .Open() in Driver or something but there is no wait.

I put an ifdef for netstandard you could try that for 4.6.1 (All this assuming its not netstandard1.3 in 4.6.1)

aharkness commented 7 years ago

I believe this is still an issue, have the same problem using "SapientGuardian.EntityFrameworkCore.MySql": "7.1.21"

SapientGuardian commented 7 years ago

@aharkness Yes, this recently regressed. Have a look at https://github.com/SapientGuardian/mysql-connector-net-netstandard/issues/33 for discussion.

aharkness commented 7 years ago

ah, ok, thanks @SapientGuardian . I can confirm that rolling back versions also fixed for me.