demetrixbio / FSharp.Data.Npgsql

F# type providers to support statically typed access to input parameters and result set of sql statement in idiomatic F# way. Data modifications via statically typed tables.
Apache License 2.0
128 stars 15 forks source link

Weird behaviour with Loading assembly #63

Open andrzejsliwa opened 4 years ago

andrzejsliwa commented 4 years ago

I have experienced weird problem with using library from FSI:

When I try to use "generate_load_scripts", on paket, its generating for me whole load scripts which I'm loading in my FSI

when I loading this this way:

#I "/Users/andrzejsliwa/.nuget/packages/fsharp.data.npgsql/0.1.49-beta/typeproviders/fsharp41/netcoreapp2.0"
#r "Npgsql.dll"
#load @"../../.paket/load/netcoreapp3.1/Server/server.group.fsx"
#load "Database.fs"
open Database
getFromUsers()

it's working

but without manually loading Npgsql I got

/SafeMe/src/Server/Database.fs(3,18): error FS0039: The namespace 'Npgsql' is not defined.

When I try to add Npgsql explicitly to paket and reference it then I got:

#load @"../../.paket/load/netcoreapp3.1/Server/server.group.fsx"
#load "Database.fs"
open Database
getFromUsers()
error FS0193: Assembly with same name is already loaded

So I'm guessing that you are loading Npgsql somehow, and without using dependencies, probably is embedded in your package, but then the way how is embedded don't let me generate properly load scripts

JeffreyPalmer commented 4 years ago

I noticed the same thing - it would be great it this worked automatically. For now I've been able to get FSI to work by commenting out all Npgsql references (Npgsql.dll and Npgsql.NetTopologySuite.dll) in the generated server.group.fsx file, and then loading like this:

#I "/Users/jeff/.nuget/packages/npgsql/4.1.3.1/lib/netstandard2.0"
#r "Npgsql.dll"
#load "../../.paket/load/netcoreapp3.1/Server/server.group.fsx"

Note that I am having to use netstandard2.0 for this to work for some reason. When I try to use the generated version that references netcoreapp3.0, I get the same errors as you.