Home
Options

Missing assembly exception when trying to use built-in typed EF Core context

In Linpad 7.6.6 when trying to connect to PostgreSQL using my typed context I get this:

Error Testing Custom EF Core Connection: Unable to load one or more of the requested types.
Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

Here is how connection is made:

The folder which is referenced contains my assembly with all dependencies, built with "Publish" in Visual Studio 2022 using .NET 6:

Attached the MedService.API.Database.deps.json which is located there.
Also attached assembly resolution log using .NET 6.
Neither of them contains the assembly in question.
Could it be that the assembly is required by the driver itself?

Comments

  • Options

    Do you get the same problem if you create a simple "hello world" context for PostgreSQL?

  • Options

    @JoeAlbahari said:
    Do you get the same problem if you create a simple "hello world" context for PostgreSQL?

    Thanks for the tip. It gave me an idea where the problem could be.

    _ = AppDomain.CurrentDomain
        .GetAssemblies()
        .SelectMany(a => a.GetTypes())
        .ToArray()
    ;
    

    A code like this leads to this problem. Looks like there are some types in LinqPad domain which when touched produce the exception of the missing assembly. But this is a required part of our DbContext. Looks like we have to find a way to enumerate types without loading assemblies or to limit them somehow.

Sign In or Register to comment.