-
Notifications
You must be signed in to change notification settings - Fork 71
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
dotnet core + npgsql entity framework core + paket loading issue #231
Comments
I've just fixed the related issue #232 However, if I switch to using #load "Paket.Generated.Refs.fsx" I get another issue: If I load a dotnet fsi instance there's a similar issue with System.ComponentModel.Composition: So the next question is if that reference is essential, if not why Paket is generating a reference to it. Commenting it out doesn't help unfortunately either. |
Could it be this reference is just stale? Have you tried running With the latest patch I don't get the |
Intellisense hints at:
|
I've been wanting to also try debugging which libraries are loaded, but trying to access
|
Good reminder on Paket.Clear() but no change there. It might be a operating system difference that you're not getting the error. Does your I recommend trying to get this working via fsi plus the Paket load scripts. Given it doesn't work there for me, it's unlikely to work in the notebook. It's a lot easier to iterate there. |
Btw if I make a new Visual Studio .NET Core project, add the Npgsql.EntityFrameworkCore.PostgreSQL NuGet then this does work there. So my guess it that this is somewhere between FSI and the load scripts Paket is creating. |
Hmm let me double check this is not actually related to version incompatability.
My |
@cgravill so it seems that the issue is related due to lazy loading of libraries. Initially none of the libraries are in the current AppDomain, and simply using #load "Paket.fsx" Paket.Version ["Microsoft.EntityFrameworkCore.Design", "2.1.2"; "Npgsql", "4.0.3"; "Npgsql.EntityFrameworkCore.PostgreSQL", "2.1.2"] #load "Paket.Generated.Refs.fsx" This one forces the libraries to actually be loaded: // reference assemblies
let failable f = try f () |> ignore with _ -> ()
failable (fun x -> Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory())
failable (fun x -> Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(null))
failable (fun x -> Microsoft.EntityFrameworkCore.RelationalEntityTypeBuilderExtensions.HasDiscriminator(null))
failable (fun x -> Remotion.Linq.Parsing.ExpressionVisitors.MemberBindings.MethodInfoBinding.Bind(null, null))
failable (fun x -> Npgsql.TypeHandling.NpgsqlSafeReadException(null))
failable (fun x -> Microsoft.EntityFrameworkCore.DbFunctionAttribute()) open Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure
open Npgsql.EntityFrameworkCore.PostgreSQL
open Microsoft.EntityFrameworkCore
let opt = DbContextOptionsBuilder().UseNpgsql("connectionstring").Options
opt.GetType() Do you have an idea where to best raise this? |
Oh wow yes, that makes a sort of technical sense but seems horrible experience-wise. Potentially this is a change in moving from .NET Framework to .NET Core? I tested in a .NET Framework notebook and didn't have an issue. @cartermp any guidance on this? |
Description
Trying to load Npgsql entity framework on dotnet core over Paket has issues, most likely related to dependencies not being loaded.
Repro steps
Expected behavior
It should generate a
DbContextOptions
.Actual behavior
Known workarounds
I sadly could not find one. I've tried loading random further libraries, but with no success.
Related information
The text was updated successfully, but these errors were encountered: