RemoteException in sql driver
There was a change made to a dev database I'm connected to. Prior to the changes, there wasn't any problems connecting and generating the context. Now I'm unable to load it at all. There are other similar database servers that don't have this problem but had the same updates.
Connecting via SSMS, I also had problems connecting and had to "Trust server certificate" to get around it. Tried setting "Accept invalid certificates" and adding TrustServerCertificate=True;
to the connection string parameters in the advanced options but it's still failing. I was previously on .net 6 still but updated to the latest and using .net 7 now and still getting this issue.
Is there a cache I can clear and not lose all my connection configurations? Found some files in %localappdata%\LINQPad
but not sure what's ok to remove.
7.7.2 (X64) 2023-02-14T17:09:41.6794554-08:00 Custom Data Context Driver MissingMethodException - Constructor on type 'LINQPad.Drivers.SqlClient.SqlServerSchemaReader' not found. Source=System.Private.CoreLib -System.RuntimeType System.Object CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) offset: 0x10F -System.Activator System.Object CreateInstance(System.Type, System.Object[]) offset: 0x0 -LINQPad.Drivers.SqlClient.SqlServerSchemaReader LINQPad.Drivers.SqlClient.SqlServerSchemaReader CreateNew() offset: 0x15 -LINQPad.Drivers.SqlClient.SqlServerSchemaReader+<>c__DisplayClass37_0 LINQPad.Extensibility.DataContext.DbSchema.Database <GetDatabase>b__1(LINQPad.Extensibility.DataContext.IConnectionInfo) offset: 0x0 -System.Linq.Enumerable+WhereSelectArrayIterator`2 Boolean MoveNext() offset: 0x3A -System.Collections.Generic.List`1 Void InsertRange(Int32, System.Collections.Generic.IEnumerable`1[T]) offset: 0xEA -LINQPad.Drivers.SqlClient.SqlServerSchemaReader LINQPad.Extensibility.DataContext.DbSchema.Database GetDatabase(LINQPad.Extensibility.DataContext.DataContextDriver, LINQPad.Extensibility.DataContext.IConnectionInfo, LINQPad.Drivers.LinkedDatabase, Boolean, System.String) offset: 0x3D4 -LINQPad.Drivers.SqlClient.SqlServerSchemaReader LINQPad.Extensibility.DataContext.DbSchema.Database GetDatabase(LINQPad.Extensibility.DataContext.DataContextDriver, LINQPad.Extensibility.DataContext.IConnectionInfo) offset: 0x1 -LINQPad.Drivers.LinqToSql.DynamicDriver System.Collections.Generic.List`1[LINQPad.Extensibility.DataContext.ExplorerItem] GetSchemaAndBuildAssembly(LINQPad.Extensibility.DataContext.IConnectionInfo, System.Reflection.AssemblyName, System.String ByRef, System.String ByRef) offset: 0x27 -LINQPad.Extensibility.DataContext.DynamicDataContextDriver LINQPad.Extensibility.DataContext.DynamicSchemaResult GetSchemaAndBuildAssemblyInternal(System.String, System.String) offset: 0x28 7.7.2 (X64) 2023-02-14T17:09:41.6875000-08:00 GuiAppHost [Thread: Name='.NET ThreadPool Worker' State=MTA IsBackground=True Pooled=True Main=False] RemoteException - MissingMethodException - Constructor on type 'LINQPad.Drivers.SqlClient.SqlServerSchemaReader' not found. Source=System.Private.CoreLib -System.RuntimeType System.Object CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) offset: 0x10F -System.Activator System.Object CreateInstance(System.Type, System.Object[]) offset: 0x0 -LINQPad.Drivers.SqlClient.SqlServerSchemaReader LINQPad.Drivers.SqlClient.SqlServerSchemaReader CreateNew() offset: 0x15 -LINQPad.Drivers.SqlClient.SqlServerSchemaReader+<>c__DisplayClass37_0 LINQPad.Extensibility.DataContext.DbSchema.Database <GetDatabase>b__1(LINQPad.Extensibility.DataContext.IConnectionInfo) offset: 0x0 -System.Linq.Enumerable+WhereSelectArrayIterator`2 Boolean MoveNext() offset: 0x3A -System.Collections.Generic.List`1 Void InsertRange(Int32, System.Collections.Generic.IEnumerable`1[T]) offset: 0xEA -LINQPad.Drivers.SqlClient.SqlServerSchemaReader LINQPad.Extensibility.DataContext.DbSchema.Database GetDatabase(LINQPad.Extensibility.DataContext.DataContextDriver, LINQPad.Extensibility.DataContext.IConnectionInfo, LINQPad.Drivers.LinkedDatabase, Boolean, System.String) offset: 0x3D4 -LINQPad.Drivers.SqlClient.SqlServerSchemaReader LINQPad.Extensibility.DataContext.DbSchema.Database GetDatabase(LINQPad.Extensibility.DataContext.DataContextDriver, LINQPad.Extensibility.DataContext.IConnectionInfo) offset: 0x1 -LINQPad.Drivers.LinqToSql.DynamicDriver System.Collections.Generic.List`1[LINQPad.Extensibility.DataContext.ExplorerItem] GetSchemaAndBuildAssembly(LINQPad.Extensibility.DataContext.IConnectionInfo, System.Reflection.AssemblyName, System.String ByRef, System.String ByRef) offset: 0x27 -LINQPad.Extensibility.DataContext.DynamicDataContextDriver LINQPad.Extensibility.DataContext.DynamicSchemaResult GetSchemaAndBuildAssemblyInternal(System.String, System.String) offset: 0x28 -System.RuntimeMethodHandle System.Object InvokeMethod(System.Object, Void**, System.Signature, Boolean) offset: 0xFFFFFFFF -System.Reflection.MethodInvoker System.Object Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags) offset: 0x54 Source=System.Private.CoreLib -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11 -System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x0 -System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28 -System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter TResult GetResult() offset: 0x0 -LINQPad.DataContextManager+<FetchDCInfoCore>d__32 Void MoveNext() offset: 0x4E9 INNER: MissingMethodException - Constructor on type 'LINQPad.Drivers.SqlClient.SqlServerSchemaReader' not found. Source=System.Private.CoreLib at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at System.Activator.CreateInstance(Type type, Object[] args) at LINQPad.Drivers.SqlClient.SqlServerSchemaReader.CreateNew() at LINQPad.Drivers.SqlClient.SqlServerSchemaReader.<>c__DisplayClass37_0.<GetDatabase>b__1(IConnectionInfo lr) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) at LINQPad.Drivers.SqlClient.SqlServerSchemaReader.GetDatabase(DataContextDriver driver, IConnectionInfo cxInfo, LinkedDatabase serverLinkedDb, Boolean sameServerLink, String systemSchema) at LINQPad.Drivers.SqlClient.SqlServerSchemaReader.GetDatabase(DataContextDriver driver, IConnectionInfo cxInfo) at LINQPad.Drivers.LinqToSql.DynamicDriver.GetSchemaAndBuildAssembly(IConnectionInfo cxInfo, AssemblyName assemblyToBuild, String& nameSpace, String& typeName) at LINQPad.Extensibility.DataContext.DynamicDataContextDriver.GetSchemaAndBuildAssemblyInternal(String repositoryData, String assemblyPathToBuild) at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
LINQPad 7 v7.7.2 x64 beta
Host runtime version: 6.0.14
Default query runtime version: 7.0.3
Default query reference assembly version: 7.0.3
Roslyn Version: 4.4.0-6.22561.11
FSharp.Compiler.Service version: 41.0.1.0
NuGet client version: 6.1.0.106
Results rendering engine: Edge Chromium Engine 109.0.1518.78 (WebView2)
Comments
You can delete everything in %localappdata%\LINQPad\7.7.2, and in any folder containing the word 'Cache' without losing any settings, logs or auto-save sessions. Let me know if this makes any difference.
Thanks Joe, but it didn't fix the problem. I've deleted all x.x.x and the DataContextCache directories and it is still throwing the error.
In what assembly and what is it's location that contains the
LINQPad.Drivers.SqlClient.SqlServerSchemaReader
class? Maybe I can do some sleuthing. Perhaps that's why I'm getting the error, the assembly is missing?It's in %localappdata%\LINQPad\7.7.2\L2S\LINQPad.Drivers.LinqToSql.dll.
I guess that client is generated because I'm not seeing it.
I suspect the problem is that the code that generates the client is unable to read from the database, but in the client properties, it's able to connect fine. I suppose the problem is something in the generator?
Using the EF driver, it loads as expected so maybe this is a corner case the L2S driver doesn't handle.
Good news - I've now got a repro and have just released a fix.
Let me know how you get along.
Thanks Joe, 7.7.3 fixes the problem. The database appears to be reading fine.
There were other changes made to the database, but I verified 7.7.2 still has the error.
By the way, I just realized that connection had additional databases included in the context, which could explain why there was a difference in behavior.
Was that the reason why it was having issues?
Yes - this was one of the triggers.