fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
570 stars 144 forks source link

The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.  Could not load file or assembly 'Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604' or one of its dependencies. #643

Closed eperacchia closed 8 months ago

eperacchia commented 4 years ago

Hello,

trying to connect MySql database to use TypeProviders on it, problem is, im getting this error when i run it.

 System.Exception: Operation could not be completed due to earlier error  The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.  Could not load file or assembly 'Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604' or one of its dependencies.

Been looking for more issues like this, but could'nt find any.

Anybody can help?

`

 #r "FSharp.Data.SqlProvider.dll"

  open FSharp.Data.Sql

   let [<Literal>] ResPath = __SOURCE_DIRECTORY__ + 
   "/mysql.data.8.0.17/lib/net452/MySql.Data.dll"
   let [<Literal>] ConnString = "Server=localhost;Database=TestDB;Trusted_connection=true"
   let [<Literal>] DbVendor= Common.DatabaseProviderTypes.MYSQL

   type DbProvider = SqlDataProvider<DbVendor,ConnString,ResolutionPath = ResPath>

`

Im on Ubuntu, working with monodevelop

Thorium commented 4 years ago

You have to have the references, including the Google.Protobuf.dll in your ResPath.

However, I recommend using the other driver for MySql, it has a lot better performance than the official one.

eperacchia commented 4 years ago

Thanks for your answer.

It's fine copy-pasting the Google.Protobuf.dll inside the ResPath containing the MySql.Data.dll?

The other drivers are the MySqlConnector?

Thorium commented 4 years ago

Yes. And yes.

eperacchia commented 4 years ago

I changed the drivers, using MySqlConnector, added System.Buffers.dll, System.Runtime.InteropServices.RuntimeInformation.dll and System.Threading.Tasks.Extensions.dll to the same folder where MySqlConnector.dll is, but I'm still getting the same error. So I added the Google.Protobuf.dll to the ResPath folder, and still no good news.

I've used all the latest release of the .dll.

Could it be a monodevelop problem? The version of monodev is 7.8.2. Or should i work on Windows? I'm using Ubuntu right now.

Thorium commented 4 years ago

Ubuntu should be fine. Do you know if your dll version match the required one? Can you try older version of the connector if it would have less dependencies?

Thorium commented 8 months ago

This is fixed