Jump to content

C# MySQL Connection


Recommended Posts

Hello, can you help me solve a C# MySQL connection problem?

The error is as follows:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'System.Security.PermissionSet' from assembly 'mscorlib, Version=, Culture=neutral , PublicKeyToken=b77a5c561934e089'.
   At MySql.Data.MySqlClient.MySqlConnection.AssertPermissions()
   At MySql.Data.MySqlClient.MySqlConnection.Open()
   At GameMode.ResourceStart()
   --- End of inner exception stack trace ---
   At System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   At System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   At GTANetworkInternals.ScriptingEngine.InvokeVoidMethod(String method, Object[] args)
   At System.Collections.Generic.List`1.ForEach(Action`1 action)
   At GTANetworkInternals.EventHandler.ParseEx(Event _event, ScriptingEngine engine, Object[] arguments)
   At System.Collections.Generic.List`1.ForEach(Action`1 action)
   At GTANetworkInternals.GameServer.StartResource(String resourceName, String parent)

I used nuget's mysql data and also referenced bootstrapper but it always gives an error. Thank you!

Link to comment
Share on other sites

  • 4 weeks later...


I had the same problem and i solved it by linking the assembly to my project. 

In my case the route was: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\SshNet.Security.Cryptography.dll

Right click on Dependencies -> Add new Assembly -> Browse... -> and in my case the Path that i mentioned before.
I hope it helped you.

Best Regards


Edited by On3ManArmy
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...