Using LINQPad with EF Core DbContext / custom DLL assembly
We have a .Net Framework-targeting DLL which contains the EF Core (v2.2) DbContext and related classes. I'd like to see how useful LINQPad would be for my team as a development tool, but I'm having trouble having it use our DLL.
I have successfully added the EF7/EF Core 2.2 driver in LINQPad, but when I try to create a new connection and set the path to the custom assembly DLL (which is in the same folder as the dll.config and pdb), it gives me this error: "Cannot load assembly: Absolute path information is required". The DLL and related files are on my C: drive, and googling has failed me so far.
For reference, I do have a parameterless constructor for my DbContext, but that doesn't seem to make a difference. I get the error after I browse to and select the DLL (the first input box of the add connection form).
So I'm hoping that someone here can help me - or at least tell me that I'm tilting at windmills because what I want to do isn't supported.
Thanks!
I have successfully added the EF7/EF Core 2.2 driver in LINQPad, but when I try to create a new connection and set the path to the custom assembly DLL (which is in the same folder as the dll.config and pdb), it gives me this error: "Cannot load assembly: Absolute path information is required". The DLL and related files are on my C: drive, and googling has failed me so far.
For reference, I do have a parameterless constructor for my DbContext, but that doesn't seem to make a difference. I get the error after I browse to and select the DLL (the first input box of the add connection form).
So I'm hoping that someone here can help me - or at least tell me that I'm tilting at windmills because what I want to do isn't supported.
Thanks!
Comments
https://www.linqpad.net/Download.aspx#beta
After entering the path to the custom assembly, ignore the error and manually type in the full type name of your typed data context (including the namespace).
Then click 'Test'. If a similar error is reported, go to %localappdata%\linqpad\logs and tell me what's in the log file. (The new beta records more information here.)
5.36.03 2019-02-14T11:13:20.9408372-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_epfntrfl\TypedDataContext_idmxnb.dll in finalizer
5.36.03 2019-02-14T11:13:20.9438351-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_epfntrfl\query_zvfhvn.dll in finalizer
5.36.03 2019-02-14T11:13:20.9468472-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_epfntrfl\query_zvfhvn.pdb in finalizer
5.36.03 2019-02-14T11:13:20.9508439-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_epfntrfl\query_qwmjqk.dll in finalizer
5.36.03 2019-02-14T12:57:16.7498461-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7678235-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7688226-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7738928-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7758914-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7818860-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7828815-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7878818-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7898993-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:57:16.7947123-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8205651-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
[[continued below]]
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8495576-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8568951-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8588927-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8642920-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8652904-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8722934-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8741348-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T12:59:43.8791316-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9130431-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9441348-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9451346-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9532589-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
[[continued below]]
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9612562-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9632544-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9692512-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9712494-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T13:02:18.9766468-06:00 SymbolManager -
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Diagnostics.SymbolStore.SymReader.GetMethod(SymbolToken method)
at LINQPad.Reflection.Internal.LocalVariableNameReader..ctor(MethodBase m)
at LINQPad.Reflection.Disassembler..ctor(MethodBase method, ILStyler styler)
First chance data:
5.36.03 2019-02-14T15:53:41.6513320-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_rtcjjwhw\TypedDataContext_idmxnb.dll in finalizer
5.36.03 2019-02-14T15:53:41.7044731-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_rtcjjwhw\query_ftusdq.dll in finalizer
5.36.03 2019-02-14T15:53:41.7123251-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_rtcjjwhw\query_blmoan.dll in finalizer
5.36.03 2019-02-14T15:53:41.7313081-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_rtcjjwhw\query_nbxrbc.dll in finalizer
5.36.03 2019-02-14T15:53:41.7372860-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_rtcjjwhw\query_drrufr.dll in finalizer
5.36.03 2019-02-14T15:53:41.7492795-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_rtcjjwhw\query_nemvyq.dll in finalizer
5.36.03 2019-02-14T15:53:41.7552757-06:00 Unable to delete file C:\Users\Kozzer\AppData\Local\Temp\LINQPad5\_rtcjjwhw\query_ttmugz.dll in finalizer
[[continued below]]
FileLoadException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at LINQPad.Extensibility.DataContext.DataContextDriver.TestProxy.TestStaticDriver(StaticDataContextDriver driver, Repository r)
at LINQPad.Extensibility.DataContext.DataContextDriver.TestProxy.Test(Repository r)
INNER: ArgumentExceptionAbsolute path information is required. at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Reflection.Assembly.LoadFile(String path)
at LINQPad.Reflection.AppDomainCreator.<>c.<ResolveCustomAssemblies>b__30_0(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
So that means something in my production DLL is causing trouble for LinqPad's integration. I suppose I could re-create my entire context in this new project, but any time the data model changes then I'd have to remember to change it in 2 places which isn't ideal.
Is there anything you can point me toward to check my prod DLL so that it can work with LinqPad?