Quantcast
Channel: LINQPad Forum
Viewing all 2658 articles
Browse latest View live

Error adding the nuget package Microsoft.CodeAnalysis.CSharp.Scripting

$
0
0
Hi,
I'm using the latest LINQPad beta
The same package can be added just fine in VS2015.

image


support for CREDENTIALPROVIDERS for nuget in LinqPad

Mismatch dll reference between autocompletion and executing

$
0
0
I made my library and debugging using LINQPad.

I added a new method into my library(dll).
I wrote new LINQPad script and added reference to my new library(dll).
I saw the added method on the method autocomplete and there are no error in LINQPad editor.

Then, I ran the script, however, MissingMethodException was occurred.
The exception said that my added method could not found.

The root cause of this error is, the older version of my dll is placed in the LINQPad folder.
LINQPad editor see the reference setting, but LINQPad executer saw LINQPad folder prior to reference setting.

I spend one hour time to resolve this problem because no error in the editor.

Specify Linqpad Connection Programatically?

$
0
0
Hello,

I hope this question hasn't already been asked and answered. I am trying to find a way in Linqpad to specify a connection (preferably by name) programatically inside a .linq file using one of the existing connections in the Linqpad gui. I have a scenario, where I need to run the same linq queries, against multiple different connections in a loop, and I already have the connections defined in Linqpad. I know that I could set up a SQL connection and change the connection string every time (but the connections are set up using a Driver and have encrypted usernames and passwords). I was hoping that there was an easy way to just specify the connection programatically by name inside the .linq file since I already have the connections set up. Also, I already know that you can use LPRun.exe and pass the parameter ( eg... lprun -lang=e -cxname=CustomerDB script.txt). While this may work, I want the process to run sequentially on the same thread (for error capturing and simplicity - avoiding callbacks, task await ect.. reasons). Is there an equivalent way to set the -cxName from inside a .linq script?

Here is a simplified version of what I am trying to do.

void Main()
{
//specify which connections I would like to run the queries against
List connectionNameList = new List();
connectionNameList.Add("Connection1");
connectionNameList.Add("Connection2");


//for each connection, run queries
foreach(string connectionName in connectionNameList)
{
try
{
RunMyQueriesFor(connectionName)
}
catch(Exception ex)
{
//write errors to log for failed query
}
}

private void RunMyQueries(string connectionName)
{
//set the connection progamatically
This.Connection = connectionName;

//get the latest info from the table
var currentQuery= SomeTable.Where(x => x.SomeDate >= Today || x.SomeOtherDate > Today);

Util.WriteCsv (currentQuery, @c:\somedirectorypath\somefilename.csv);

}

}


Thanks,

Tim

CompiledQuery in LinqPad

$
0
0
I have seen this example here: http://www.albahari.com/nutshell/speedinguplinqtosql.aspx. It says the compiled query can be and pasted into LinqPad in the article but that is not the case. The query uses a variable "TypedDataContext" which LinqPad does not recognise. I am using LinqPad 5. What is it that I am missing here. I politely suggest that the article is incorrect and you just cant copy and paste that code into LinqPad - you need to get the TypedDataContext from somewhere. Where?

I am trying to work out how to compile a query. Our simplified query I want to compile is:

var flows = FlowModels.Include(x => x.Owner)
.Include(x => x.Status)
.Where(x => x.WorkflowStatusId == 3)
);

How do I compiled this in LinqPad?

Many thanks.

Timeout trying to connect to a database

$
0
0
I've just created a new database on my hosted server, and can connect fine to it using SQL Server Management Studio. However, when I try to connect via LinqPad, I get a message "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding" when I try to open the dropdown next to "Specify new or existing database." If I click the "Display all in a TreeView" then the Test button is enabled, and if I click it, it tells me the connection was successful.

Anyone any ideas? I've obviously entered the right connection info, it just won't populate the dropdown. I've successfully connected to other database on this shared hosting before, so it's not that.

Thanks for any help you can give

Missing Method Exceptions

$
0
0
I have several queries that give me a missing method exception in LinqPad 5, but not in LinqPad4.
I've just discovered it's not restricted to F#.
In many cases, I tried adding a manual reference to FSharp.Core.dll, but that didn't help

examples (just the ones I've managed to re-find since finding them working in VS or giving up) :
http://share.linqpad.net/dfo2pe.linq (still works in linqpad 4)
http://share.linqpad.net/r92xt3.linq (still works in linqpad 4)
http://share.linqpad.net/eqc296.linq (still works in linqpad 4) - https://github.com/kerams/Templatus/issues/18

// this one needs the templatus package downloaded (which linqpad says doesn't contain any .net packages, then deletes the download, so I have to manually download it outside of nuget)
http://share.linqpad.net/92x6fa.linq

looks like the last one works in linqpad 4 regardless of C# or F#, but missingmethod exception in linqpad5

Latet beta c# 7 tupels are not working

$
0
0
Hi,

With Tuples samples I am getting following error.

CS8179 Predefined type 'System.ValueTuple`2' is not defined or imported

Compiler executable file csc.exe cannot be found

$
0
0
I am trying to use the Visual FoxPro LPX with the OleDb driver. It tests out OK, but when I try to expand the connection and it starts to build the necessary tables and such, it generates the error. I can see from monitoring LINQPad with procmon from Sysinternals that it enumerates all the FoxPro tables. It looks like it is bombing out after querying the HKLM\SOFTWARE\WOW6432Node\Microsoft\MSBuild\ToolsVersions\3.5 registry key - which does not exist on this Win10 box. Instead of 3.5 I have a 4.0 and 14.0 keys. I am running LINQPad v5.10. I can also see that LINQPad is generating a couple of temp .cs and .cmdline files... but it deletes them before I have a chance to inspect their contents.

Other connections do still work just fine. Do I just need to install .NET 3.5 on this computer to make this connection work?

Here is the relevant bits from the logs:
5.10.00 2016-11-18T11:30:13.0792812-07:00 Error opening DataContext -
DisplayToUserException: InvalidOperationException - Compiler executable file csc.exe cannot be found.

Server stack trace:
at LINQPad.SchemaBuilder.GetSchemaAndBuildAssembly(String repositoryData, AssemblyName assemblyToBuild, String& nameSpace, String& typeName, Boolean allowOneToOne, IDictionary`2& sessionData)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at LINQPad.SchemaBuilder.GetSchemaAndBuildAssembly(String repositoryData, AssemblyName assemblyToBuild, String& nameSpace, String& typeName, Boolean allowOneToOne, IDictionary`2& sessionData)
at LINQPad.DataContextManager.<>c__DisplayClass30_1.b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
at LINQPad.DataContextManager.d__30.MoveNext()
First chance data: LINQPad.SchemaBuilder.GetSchemaAndBuildAssembly(repositoryData,assemblyToBuild,nameSpace,typeName,allowOneToOne,sessionData) offset=0xFFFFFFFF
-LINQPad.DataContextManager+<>c__DisplayClass30_1.b__0() offset=0x2B

LINQPad.DataContextManager+d__30.MoveNext() offset=0x3D8
-LINQPad.TaskExtensions+<>c__DisplayClass24_0`1.b__1(ant) offset=0x40

Referring ".linq" files within LINQPad

$
0
0
Hi,

I would like to know if it is possible to refer a ".ling" file to queries (other ".linq" files) as we work in the LINQPad application.
The way we can actually refer DLLs, per example.

Thanks

Xcopy deployed query with data connection seems need a manual execution (F5) before it runs in LPRun

$
0
0
When someone has made changes to a query on and it's pulled out from the repo onto another machine and executed using LPRun, it produces the error message "Login failed for user".
If I open the query on the failing machine and press F5, then it starts working.

Does this sound plausible?

support for adding a dll with environment variables

$
0
0
I'd like to be able to add a reference to:

%dscriptcode%\ScriptCode.ConvertedToC#\bin\x86\Debug\ScriptCode.exe

The environment variable for %dscriptcode% has different values on my two different machines and I store my linqpad queries in dropbox. Ideally I'd like to be able for this to work on both machines from the same script.

Activation via proxy in big infrastructure

$
0
0
Hi,

we purchased the LinQPad Premium Enterprise License and we are about to distribute it to our users.
But there is a problem with the activation of the software. We packaged the software and ensured that the proxy.xml is written first. But we require authenticated proxy requests in our company and we don´t want to use an specific user just for the proxy authentication for this software. So my questions is which URL or URLs do we have to exclude from proxy authentication to avoid this behaviour. The goal is to just write down our proxy details in proxy.xml but no user details.

Thanks in advance,
Max

Multiple Databases -- CS0103 error

$
0
0
My 'Connection' says: LQWAXDBPROD.DABC + DYNAMICS_AX

Using C# Statement(s) my partial code looks like this:

var results = (from a in AX_REALTIME_ADJUSTMENTS //From the DABC DB
.Where(x => x.POSTED == 1)
from j in WMSJOURNALTABLEs //From the DYNAMICS_AX DB
.Where(x => x.UT_AP_VARIANCEJOURNALID = a.JOURNALID)
.DefaultIfEmpty()
select new {
a.INVENTLOCATIONID
}).Dump();
I get the error: "CS0103 The name 'WMSJOURNALTABLEs' does not exist in the current context"

When I open up the list of 'Tables' under the DYNAMICS_AX database, I can see the WMSJOURNALTABLEs is there and it is spelled exactly like I have it in my LINQ statement?

Adding a reference to UI assembly

$
0
0
I have added many "using" statements to Additional Namespace Imports such as

System
System.Collections.Generic
System.ComponentModel
System.Data
System.Drawing
System.Drawing.Drawing2D
System.Text
System.Windows.Forms
System.Windows.Forms.VisualStyles

But when I reference it I still show an error that the symbol is undefined (CS0234). For example

public class Form1 : System.Windows.Forms.Form

Hovering over "Form" that shows red gives me this error.

Ideas?

Thank you.

Context.GetValidationErrors

$
0
0
Is there a way to access GetValidationErrors in LinqPad? When i call SubmitChanges(), I get a data truncation error but it does not indicate which field. The GetValidationErrors has the information I need but I don't have a context object to use to call this method.

is there a way to get N datagrids exported as N sheets in a single spreadsheet?

$
0
0
Currently I have a script which does about a dozen queries and .Dump()s each of them such that I end up with about a dozen data grids in the output pane.

To create a spreadsheet of each of those, AFAICT I currently have to export each as Excel or CSV an then create a spreadsheet that combines each of them. I could certainly use excel interop and programmatically create one, but that'd be a pretty decent chunk of work to do so AFAICT.

Since it seems like LINQPad has all the heavy lifting logic already in place, I wondered if there was a simple extension I could write that would leverage that and create a single spreadsheet with N sheets inside of it?

I can Util.WriteCsv each of them

If not, Joe, please consider this a polite feature request. :)

Error Could not load file or assembly System.Web.Http in WebApi VB.NET Project

$
0
0
Hallo,

I am using the latest LinqPad version (v5.08.01 AnyCPU)

I have a WebApi project with a code-first Entity Framework model. The following NuGet packages are installed
Id Versions
-- --------
DynamicLINQ {1.0}
EntityFramework {6.1.3}
EntityFramework.de {6.1.3}
EntityFramework.Functions {1.3.1}
LinqKit {1.1.3.1}
Microsoft.AspNet.WebApi {5.2.3}
Microsoft.AspNet.WebApi.Client {5.2.3}
Microsoft.AspNet.WebApi.Client.de {5.2.3}
Microsoft.AspNet.WebApi.Core {5.2.3}
Microsoft.AspNet.WebApi.Core.de {5.2.3}
Microsoft.AspNet.WebApi.OData {5.3.1}
Microsoft.AspNet.WebApi.WebHost {5.2.3}
Microsoft.AspNet.WebApi.WebHost.de {5.2.3}
Microsoft.Data.Edm {5.6.0}
Microsoft.Data.OData {5.6.0}
Microsoft.Net.Compilers {1.0.0}
Newtonsoft.Json {6.0.4}
System.Spatial {5.6.0}

I created a new query in LinqPad. Added all the NuGet Packeges.
I try to add a conncetion using the Entity Framework (DbContext V4/V5/V6) Option.
I add the path to the dll generated in the WebApi porject. I get the following error message:

Could not load file or assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

The Web Api project is referencing Version 5.2.3.0 (Specific Verion is set to false).
I added the following to the app.config:
      <dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
I still get the error message.

Any help would be appreciated!


Collapse and Expand Loops, Ifs etc...

$
0
0
Hi everyone,
when I'm writing a program, I get a collapse [-] and an expand [+] for my sub.

Is it possible to collapse and expand loops and Ifs etc in a C# statement?

This would make all of my codes a lot more clear...

[BUG] Reference needed note

$
0
0
When intellisense, auto-completion, or the compilation needs a reference that it knows about it will not tell you what it is.

Simple reproduction:

add package reference to FSharp.Charting
code:
FSharp.Charting.Chart.Line [ 1,2;3,4] |> fun x -> x
then hit . after the x

tab adds `<note>` to the code, and the note won't show any tooltip about what reference is needed.

screen shot (dimmed because ctrl dims autocomplete, and is needed to tell windows to capture pop-ups in screenshots)
image
and VS image

or (both should show up) at
Screen shot
Viewing all 2658 articles
Browse latest View live