Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

... Unable to load one or more of the requested types ... #665

Open
travis-leith opened this issue Jan 28, 2020 · 4 comments
Open

... Unable to load one or more of the requested types ... #665

travis-leith opened this issue Jan 28, 2020 · 4 comments

Comments

@travis-leith
Copy link

@travis-leith travis-leith commented Jan 28, 2020

Description

I am trying to get a basic demo working against MariaDB10 using MySqlConnector but can't get it to compile. The advice given in this related issue doesn't seem to help.

Repro steps

Create a project with the following code

open FSharp.Data.Sql

[<Literal>]
let connString  = "Server=***;Database=market_data;Uid=***;Pwd=***;Port=3307;AllowLoadLocalInfile=true"

[<Literal>]
let dbVendor    = Common.DatabaseProviderTypes.MYSQL


[<Literal>]
let connString2 = @"Server=DESKTOP-7N1E2PV;Database=factor_investments;User Id=Travis;Password=welcome123;"

[<Literal>]
let resPath = __SOURCE_DIRECTORY__ + "/DLLs"

[<Literal>]
let useOptTypes = true

type sql = 
    SqlDataProvider<
        Common.DatabaseProviderTypes.MYSQL,
        connString,
        ResolutionPath = resPath,
        UseOptionTypes = useOptTypes>

//let ctx = sql.GetDataContext()

[<EntryPoint>]
let main argv =
    printfn "Hello World from F#!"
    0 // return an integer exit code

and the following libraries

<ItemGroup>
    <PackageReference Include="MySqlConnector" Version="0.61.0" />
    <PackageReference Include="SQLProvider" Version="1.1.76" />
    <PackageReference Include="System.Console" Version="4.3.1" />
    <PackageReference Include="System.Data.Common" Version="4.3.0" />
    <PackageReference Include="System.Reflection" Version="4.3.0" />
    <PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
    <PackageReference Include="System.Runtime" Version="4.3.1" />
    <PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
    <PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
    <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
  </ItemGroup>

Place the MySqlConnector.dll in the 'DLLs' folder and try to build.

Expected behavior

Successful build

Actual behavior

The following compile error is given

Severity	Code	Description	Project	File	Line	Suppression State
Error	FS3033	The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Details: 
Could not load type 'System.ICloneable' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Data.Common.DbCommandBuilder' from assembly 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Data.Common.DbDataAdapter' from assembly 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Data.Common.RowUpdatingEventArgs' from assembly 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Data.Common.RowUpdatedEventArgs' from assembly 'System.Data.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load file or assembly 'System.Runtime.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'System.Net.Primitives, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Could not load type 'System.ReadOnlyMemory`1' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.IO.Stream' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.ReadOnlySpan`1' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load file or assembly 'System.Memory, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'System.Transactions.Local, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Could not load type 'System.Runtime.CompilerServices.IAsyncStateMachine' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Could not load type 'System.Memory`1' from assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	Analytics	xxx\Program.fs	20	Active

Related information

  • MariaDb
  • Windows 10
  • .NET Core 3.1
@Thorium
Copy link
Member

@Thorium Thorium commented Jan 28, 2020

I think with type providers you should use compiletime the full .NET framework dll and runtime the Core dll.

@travis-leith
Copy link
Author

@travis-leith travis-leith commented Jan 29, 2020

@Thorium the instructions given in your link almost worked; they were able to remove errors visible in VS, but upon building I get the following error
The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.�Details: �Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.�Could not load file or assembly 'System.Threading.Tasks.Extensions,...

So I added the package System.Memory and copied the dll to the libraries folder, then upon building I get

The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe,...

I have tried adding the packing System.Runtime.CompilerServices.Unsafe and copying the dll but no change in error.

Also, the test project in this repo does not work for me. Trying to build results in

Severity	Code	Description	Project	File	Line	Suppression State
Error	FS3033	The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Exception has been thrown by the target of an invocation.	SqlProvider.Core.Tests	C:\repos\New folder\SQLProvider\tests\SqlProvider.Core.Tests\MySql\Program.fs	30	Active

@Thorium
Copy link
Member

@Thorium Thorium commented Feb 4, 2020

Hi, I upgraded few system references, to SQLProvider 1.1.79, hope that helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.