Home

Can't connect using EntityFrameworkCore 5.0.2 typed context

edited January 15

I'm trying to create a connection to a Plex database (sqlite) so I could try to script out some tasks in LinqPad. Unfortunately I cannot use the builtin database driver because the database uses some extensions that causes errors during scaffolding.

To try to work around this, I tried brute force creating the context separately excluding problematic tables and was able to create the assembly. Now when I try to create the connection using it, I keep getting errors saying EFCore libs not found.

I built using the latest .net sdk 5.0.102 targeting net5.0 and EF Core 5.0.2. Is LinqPad not able to use the current latest driver?

6.12.3 (X64) 2021-01-14T21:00:36.4512426-08:00 PopulateInstantiationOptions
RemoteException - FileNotFoundException - Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=5.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
Source=System.Private.CoreLib

 -System.Reflection.RuntimeAssembly Void GetType(System.Runtime.CompilerServices.QCallAssembly, System.String, Boolean, Boolean, System.Runtime.CompilerServices.ObjectHandleOnStack, System.Runtime.CompilerServices.ObjectHandleOnStack, System.Runtime.CompilerServices.ObjectHandleOnStack) offset: 0x0
 -System.Reflection.RuntimeAssembly System.Type GetType(System.String, Boolean, Boolean) offset: 0x21
 -System.Reflection.Assembly System.Type GetType(System.String, Boolean) offset: 0x0
 -LINQPad.Drivers.EFCore.StaticDriver Int32 GetInstantiationOptions(LINQPad.Extensibility.DataContext.ICustomTypeInfo) offset: 0x30
 -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
 -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw(System.Exception) offset: 0x0
 -LINQPad.SystemExtensions Void ThrowWithOriginalStackTrace(System.Exception) offset: 0x1
 -LINQPad.Extensibility.DataContext.DataContextDriver System.Object RunInNewProcessCore(System.String, System.Object[]) offset: 0x6B

Source=System.Private.CoreLib

 -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
 -System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x26
 -System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
 -System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter TResult GetResult() offset: 0x0
 -LINQPad.TaskExtensions+<Then>d__46`2 Void MoveNext() offset: 0x101
 -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
 -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw(System.Exception) offset: 0x0
 -LINQPad.SystemExtensions Void ThrowWithOriginalStackTrace(System.Exception) offset: 0x1
 -LINQPad.TaskExtensions T GetResult[T](System.Threading.Tasks.Task`1[T]) offset: 0x7D
 -LINQPad.Extensibility.DataContext.DriverProxy`1 TResult Eval[TResult](System.Linq.Expressions.Expression`1[System.Func`2[T,TResult]], Boolean) offset: 0x20
 -LINQPad.Extensibility.DataContext.DataContextDriver System.Object RunInNewProcess(System.String, System.Object[], LINQPad.Extensibility.DataContext.IConnectionInfo) offset: 0xC0
 -LINQPad.Drivers.EFCore.DbContextCxForm+<PopulateInstantiationOptions>d__19 Void MoveNext() offset: 0x174


   INNER: FileNotFoundException - Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=5.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
   Source=System.Private.CoreLib

      at System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext)
      at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
      at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
      at LINQPad.Drivers.EFCore.StaticDriver.GetInstantiationOptions(ICustomTypeInfo typeInfo)
   --- End of stack trace from previous location ---
      at LINQPad.SystemExtensions.ThrowWithOriginalStackTrace(Exception ex)
      at LINQPad.Extensibility.DataContext.DataContextDriver.RunInNewProcessCore(String methodName, Object[] args)

I am able to run queries with the connection selected, but only if I add references to EF Core and the EF Core Sqlite driver, the contents just doesn't load in the connection window.

Comments

Sign In or Register to comment.