Home

ArgumentNullException when running SQL script with lprun6 (works with lprun from LINQPad 5)

I have a SQL LINQPad script using the LINQ to SQL driver. When I run the script in LINQPad 6 (6.7.5 64-bit) it works:

SELECT @@Version AS Version;

Result:

However when I use lprun I get an exception:

> lprun6 -format=csv .\get-version.linq > .\get-version.csv
ArgumentNullException: Value cannot be null. (Parameter 'instance')
   at LINQPad.ExecutionModel.Proxy`1..ctor(TRemote instance)
   at lambda_method(Closure )
   at LINQPad.ExecutionModel.FastChannel.GetExprValue(Expression expr, Boolean deferLocalInstanceProperty)
   at LINQPad.ExecutionModel.FastChannel.<>c__44`2.<FastEvalExpr>b__44_1(Expression a)
   at System.Linq.Enumerable.SelectIListIterator`2.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at LINQPad.ExecutionModel.FastChannel.<>c__DisplayClass44_0`2.<FastEvalExpr>b__0(T x)
   at LINQPad.ExecutionModel.Proxy`1.Run(Expression`1 remoteMethod)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
   at LINQPad.SystemExtensions.ThrowWithOriginalStackTrace(Exception ex)
   at LINQPad.TaskExtensions.WaitEx(Task t, Nullable`1 timeout)
   at LINQPad.ExecutionModel.Client.RunSqlQuery()
   at LINQPad.ExecutionModel.Client.Start(Boolean waitForDebugger)
   at LINQPad.RunnableQuery.<>c__DisplayClass96_0.<Run>b__2()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

If I use lprun from LINQPad 5 (5.41.00 32-bit) it works:

> lprun -format=csv .\get-version.linq > .\get-version.csv

Result:

Version
"Microsoft SQL Server 2019 (RTM-GDR) (KB4517790) - 15.0.2070.41 (X64) 
    Oct 28 2019 19:56:59 
    Copyright (C) 2019 Microsoft Corporation
    Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 18363: ) (Hypervisor)
"

Thank you for an amazing tool, it is such a time saver! The reason I'm reporting this is because I'm working with a fairly big dataset and lprun from LINQPad 5 is 32-bit and I get an OutOfMemoryException.

Comments

Sign In or Register to comment.