Problem running stand-alone script after running it with parameters.
To illustrate this issue, create a script
void Main(params string[] args) { args.Dump(); }
and save it as ShowParameters in your default queries folder.
If you run this query, it shows that args is null.
Then create a new query as follows
Util.OpenQuery(Path.Combine(Util.MyQueriesFolder , "ShowParameters.linq"), true, false, new string[] { "x" , "y"}).Dump();
When you run this query, it should run the first query and dump out the parameters "x" and "y"
All good so far.
But then if you re-run ShowParameters by itself , it still shows the parameters "x" and "y" when it should show null and it still does this even after the script has been amended and recompiled.
I have to close and restart Linqpad to get rid of the parameters.
A secondary very minor issue is - if I try to use the option "Reflect Query in ILSpy' it displays the error
Cannot find 'M:UserQuery.Main' in command line specified assemblies.
Comments
ShowParameters
run query.ShowParameters
script.ShowParameters
script.Run. Result:
null
No need to restart LINQPad (x64 8.7.2)
Thanks.
So obvious I can't believe I didn't try it!
I've fixed the issue with 'Reflect Query in ILSpy' in the latest beta.
Regarding the sticky arguments, I'm not sure what to do about this. If LINQPad dishonored the arguments when you re-ran the script, this could be annoying, too.
Thanks.
I guess this all comes down to what we expect to happen.
Now that I know this is the way it works I have found another way to do what I wanted.