Home

LINQPad 6 Preview: Unable to create database connection

I downloaded the LINQPad 6 preview and am attempting to establish a connection to an EF Core context defined in a .NET Standard 2.0 DLL. I do have a constructor in my DBContext class that takes a connection string parameter. I ran my application and set a breakpoint on that constructor. When the breakpoint was hit, I copied the connection string and pasted it into LINQPad's "Entity Framework DbContext Connection" dialog (that connection string *does* work in my application).

When I test the connection in LINQPad, I get this error message:

Error Testing EF Core Connection: Could not load file or assembly 'System.Data.SqlClient, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

I saw this message referenced in another forum post where the poster said he was attempting to run some kind of script. I'm just trying to establish a connection, using a .NET Standard 2.0 DLL. I don't see how .NET Framework 4.x would be involved in any way in my scenario.

I am clueless as to what to do next. Can someone please help?

Comments

  • Please right-click the connection and choose "Show Assembly Resolution Log" and paste in what it shows.
  • edited March 2020

    I'm getting this problem too, I can see a reference in the Assembly Resolution log, but it's not loading, also I get this message when connecting to a specific database. Tried copying different versions of the dll into the directory specified in the assembly resolution log to no avail

  • Managed references:
    ˄(6 items)
    Path Reference Runtime
    C:\Program Files\LINQPad6\LINQPad.Runtime.dll Yes Yes
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\L2S\LINQPad.Drivers.LinqToSql.dll Yes Yes
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\L2S\Microsoft.SqlServer.Types.dll Yes Yes
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\L2S\SD.Tools.LinqToSQL2.dll Yes Yes
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\LINQPad.Runtime.UI.dll Yes
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\LINQPad.Windows.Forms.DataVisualization.dll Yes
    Native references:
    (0 items)
    Missing NuGet references:
    ˄MissingNuGets
    LINQPad.NuGetInterop.MissingNuGets
    DirectReferences
    (0 items)
    Frameworks
    ˄PackageIdentity[2]
    HasVersion Id Version
    True Microsoft.NETCore.app.ref 3.1.1
    True Microsoft.WindowsDesktop.app.ref 3.1.1
    Transitives
    (0 items)
    ASP.NET Version: (none)

    Framework reference assemblies (NetCore version=3.1.1, Desktop version=3.1.1):
    ˄IOrderedEnumerable (213 items)
    C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.app\3.1.1\Microsoft.CSharp.dll
    C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.app\3.1.1\Microsoft.VisualBasic.Core.dll
    ....

    LOG:

    LINQPad.Runtime:
    C:\Program Files\LINQPad6\LINQPad.Runtime.dll
    Driver assembly:
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\L2S\LINQPad.Drivers.LinqToSql.dll
    Extra driver assemblies
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\L2S\Microsoft.SqlServer.Types.dll
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\L2S\SD.Tools.LinqToSQL2.dll
    LINQPad.Runtime.UI:
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\LINQPad.Runtime.UI.dll
    LINQPad.Windows.Forms.DataVisualization.dll:
    D:\Users\myuser\AppData\Local\LINQPad\6.6.8\LINQPad.Windows.Forms.DataVisualization.dll

  • i installed linqpad5 and it worked

  • Have you tried restarting LINQPad? You should see the following in the assembly resolution log:

    AppData\Local\LINQPad\6.6.8\L2S\System.Data.SqlClient.dll

  • edited March 2020

    Hi Joe, yes it does show that in the resolution log, so I can see
    d:\Users\myuser\AppData\Local\LINQPad\6.6.8\L2S\System.Data.SqlClient.dll

    However i'm still getting the error
    Could not load file or assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

  • Is this a normal LINQ-to-SQL connection? Or are you using an Entity Framework connection?

    Try deleting the AppData\Local\LINQPad\6.6.8 folder (LINQPad will recreate it on startup).

    Also, if you click 'Test' on the connection properties dialog, does it work? And if you right-click the connection and choose one of the built-in queries such as '.Take(100)', does that work?

Sign In or Register to comment.