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

C# Statement shows no results but results contain 3 values; why?

$
0
0
Hello -

I am new to LINQPad and just purchased my upgraded license. I went to run the following statement and it returns no results.

EPDMReferenceToolLicenseManagements.Where(epdmrtlm => epdmrtlm.DataField_Company == "Trident");

I know there is data in there that equals that value so I updated the code to be:

var res = EPDMReferenceToolLicenseManagements.Where(epdmrtlm => epdmrtlm.DataField_Company == "Trident"); Console.Write(res.Count());

The result is a value of 3, which is correct. Why does the data not show after the first statement? What am I missing?

MSTest with TestRunner inside LinqPad - Unresolved references in LinqPad.dll for a query

$
0
0
Hello there,

My goal is to run MsTests in LinqPad the same way I can NUnit inspired by this blog post( http://simoneb.github.io/blog/2012/10/28/nunit-via-linqpad/)

I have found this https://github.com/macro187/testrunner for running the tests via the console.

I managed to get it that far:

void Main()
{
// if is in the same process!
var testAsssembly = Assembly.GetExecutingAssembly().Location.Dump();

var testRunner = typeof(TestRunner.Program.TestResult).Assembly.Location.Dump();

Util.Cmd(testRunner, testAsssembly);
}


[TestClass]
public class Tests
{
[TestMethod]
public static void AlwaysTrue()
{
Assert.IsTrue(true);
}
}

with references added via NuGET:
MsTest.TestFramework, TestRunner

The error I get is :
"An internal error occurred in TestRunner.exe:
Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Type: System.IO.FileNotFoundException"

Out of curiosity I decompiled just the LinqPad.dll for the query in ILSpy (standalone) and found the same "unresolved" reference.

I would appreciate any help.


Auto Displaying Values

$
0
0
Hi,

sorry I am new to this. How would I be able to auto expand the values highlighted in yellow automatically please?

image

NuGet window "show assemblies in package" is missing a file.

$
0
0
I have two machines on my office desk. Both running LINQPad.

I am accessing the same internal nuget server. Only difference is that I added the Nuget server through the LINQPad GUI on machine A, and copied the LINQPad settings file onto machine B.

When query was copied and pulled up inside LINQPad on machine B, it retrieved the package, but the query doesn't compile. The package is a single dll and a single dll from a dependency.

In the "show assemblies in package" on both computers, machine B shows only the (indirect) dependency assembly (1 file) whereas machine A shows both assemblies (the actual assembly as well as the external dependency assembly).

I don't see any error messages. A colleague tried to add the dependency this morning and he sees both assemblies.

I tried removing the nuget server entry and adding it manually. Then re-adding the nuget package after clearing the cache. No effect.

No matter what I do, the nuget package assembly wont appear. I have inspected the cache and the assembly is downloaded. It is just not reflected in LINQPad.

Namespace issue with expression vs using DbContext?

$
0
0
the following query generates an error in LinqPad:
from a in DcProductionAreas let b = "24.00".ParseDouble() select b
InvalidOperationException: The ModelDefinedFunctionAttribute for method ParseDouble must have namespaceName set to 'CodeFirstNamespace'.

Yet I can do the same thing as C# statements
using (var db = new DbEnvoyEFLib.DbEnvoyContext()) { var result = from a in db.DcProductionAreas let b = "24.00".ParseDouble() select b; result.Dump(); }

Linqpad can't differentiate between x86 and AnyCPU version when launching

$
0
0
1. Launch Linqpad(AnyCpu)

2. From command line try to open a .linq script in the x86 version:
@C:\Program Files (x86)\LINQPad5\LINQPad.exe "C:\Dropbox\LinqpadShared\LINQPad Queries\TextManipulation\PowerText52.linq"

3. The file opens in the existing LinqPad(AnyCpu) instance. It seems to open in whatever instance was launched first.

This is a problem since Linqpad can't run scripts that reference x64 dlls from the x86 instance and vice-versa. So I have some scripts that need to open in one instance, and some that need to open in the other.

Browser version

How to delete Debugger Watch Symbol?

$
0
0
I have added the symbol for debugger to watch. Now I could not find where to delete that symbol once I am done with that symbol. Please point me to the right direction. Thanks.

Linqpad 5.31.00 CTRL+{ shortcut not working on belgian keyboard

$
0
0
And also CTRL+] ...

Any idea how we can access these ?

This probleem keeps comming back every now and then. ( e.g. the multicolumn selection backtick... )
A general keyboard shortcut manager + suggested shortcut layouts per language downloadable?

Help Tooltip Message

$
0
0
Can anyone tell me how I can disable this from popping up? I find it very distracting.

image

Thanks

Grouping of tables in LINQPad

$
0
0
When I look at the WorldWideImporters database (Microsoft sample) in LINQPad, I see this:

image

But in SQL Server Management Studio (v17.7), I see the same database displayed as follows:

image

What is the capability/feature in LINQPad that imposes structure to the tables, grouping them under "Application", "DataLoadSimulation", etc, as shown?

Thank you.

Poor LpRun startup performance for simple script

$
0
0
When I have LinqPad up and running new scripts I write compile and execute nearly instantaneously.

However, when running on the command line via LpRun there is quite a long delay even for a trival script (~3-4 seconds).

I'm thinking of working around this by creating an LpRun background process that listens for execution requests and executes them using Util.Run() to avoid the startup overhead.

However, I'm wondering whether others have experienced this performance issue and whether built-in approaches are available for working around this?

How to run SQLite EFCore 2.0 in LinqPad?

$
0
0
a simple code I was trying to help from StackOveflow:

nuget packages used:

Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Sqlite

program in C#

----
void Main()
{
var connection = new Microsoft.Data.Sqlite.SqliteConnection("DataSource=:memory:");

connection.Open();

var options = new Microsoft.EntityFrameworkCore.DbContextOptionsBuilder()
.UseSqlite(connection)
.Options;

var context = new TestDbContext(options);

context.Database.EnsureCreated();

var items = new List
{
new Item{Id = 1, Name = "Item 1", Price = 100},
new Item{Id = 2, Name = "Item 2", Price = 10},
new Item{Id = 3, Name = "Item 3", Price = 0},
new Item{Id = 4, Name = "Item 4", Price = -1},
new Item{Id = 5, Name = "Item 5", Price = -5}
};

var query1 = items.Where(x => x.Price > 0).Select(x => x.Name);
var results1 = query1.ToArray();
($"Items with price greater than 0 - {string.Join(",", results1)}").Dump("results 1");

var query2 = items.Where(x => x.Price > -1m).Select(x => x.Name);
var results2 = query2.ToArray();
($"Items with price greater than -1 - {string.Join(",", results2)}").Dump("results 2");

var query3 = items.Where(x => decimal.Negate(x.Price) < 1).Select(x => x.Name);
var results3 = query3.ToArray();
($"Items with price greater than -1 - {string.Join(",", results3)}").Dump("results 3");
}

public class Item
{
public long Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}

class TestDbContext : Microsoft.EntityFrameworkCore.DbContext
{
public TestDbContext(Microsoft.EntityFrameworkCore.DbContextOptions options) : base(options) { }
public Microsoft.EntityFrameworkCore.DbSet Items { get; set; }
}
----

I get an error:

> Unable to load DLL 'e_sqlite3': The specified module could not be found.

before I was getting

> Could not load file or assembly 'SQLitePCLRaw.provider.e_sqlite3...

but I could, somehow, move along

Thank you.

DependencyResolutionException after latest update

$
0
0
I like to test all of my services via Autofac and after the latest update it first lost all references to my previous scripts and I had to re-establish them but then even after doing that I am now getting an error stating:

Could not load file or assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies

Not sure what to do at this point.

Im glad I now registered

$
0
0
You stated that superbly.

Look into my web-site ...

SSO Authentication Default Browser and Account

$
0
0
Background
I have a script that authenticate me through my Azure. This is really a single sign on auth to acquire STS token where LINQPad would show a browser for me to login. See the code below.

Issue and Attempt
I think the issue might have bee with the embedded web view in Linqpad. It is always default to a certain account and there's no way to clear cookies on this web view.
I also think this somewhat has to do with Windows Authentication. Whenever I'm on my corporate network, it default the login to my corporate account. The web view seems to pick up my Windows Authentication, thus, use the corporate account as default. This makes me suspect that LinqPad is using IE as the web view.
Similarly, in PowerShell, I can run `Login-AzureRmAccount` command, it would authenticate through SSO to acquire STS token. If I'm on the corporate network, PowerShell will also default to my corporate account. However, when I get off corporate network, it no longer default to corporate account.

The Ask.
Is there a way to specify browser to use for the web view? Or, is there a way to clear the cookies in that web view (not that I think it'd help since it's defaulting to my corporate account)?

Code
This is my code to authenticate with Azure

var aadInstance = "https://login.windows.net/{0}";
var resourceId = "https://someresource.windows.net/";
var aadTenantId = "";
var aadLinqpadClientId = "";
var aadLinqpadClientRedirectUri = "";

// Authenticate with Azure AD
AuthenticationContext authenticationContext;
if (TokenCache != null)
authenticationContext = new AuthenticationContext(string.Format(aadInstance, aadTenantId), TokenCache);
else
authenticationContext = new AuthenticationContext(string.Format(aadInstance, aadTenantId));
var authenticationResult = authenticationContext.AcquireTokenAsync(resourceId, aadLinqpadClientId, new Uri(aadLinqpadClientRedirectUri), new PlatformParameters(PromptBehavior.Auto)).Result;

if (authenticationResult == null)
throw new InvalidOperationException("Failed to obtain token");

return authenticationResult;


Any help would be appreciate it. Thanks!

SQL TO LINQ

$
0
0
Hi

SELECT *
FROM Purchase
WHERE Price > 10
ORDER BY
CASE WHEN Price > 1500 THEN Price END DESC,
CASE WHEN Price <= 1500 THEN Price END ASC

How to express this SQL into

IQueryable orderedQuery = .... ?

Any help would be appreciate it. Thanks!
Reiner

Just wanted to say Hello!

$
0
0
Every day, millions of people store for precious jewelry. Numerous people acquire fashion jewelry, it is not constantly easy to go shopping for jewelry, as there are lots of different kinds for different people.

If you are aiming to purchase sterling silver fashion jewelry online, see to it to additionally buy a silver acid screening package. Such kits are extensively offered online too for under ten bucks. They give a secure way for you to acid test the precious jewelry you receive to make certain of its credibility. This way, if you are acquiring a vintage item that could not be hallmarked, you are still able to recognize that you have not been scammed.

When looking for diamonds, make certain that you purchase them based on their 4 main criteria: shade, cut, clarity, as well as carat weight. The shade refers to the hue of the stone. The cut refers to the way that the rock is fashioned, such as princess as well as square cuts. Clearness describes the flawlessness of the stone. The carat weight describes the weight of the rock.

Make sure you know what to look for when acquiring platinum fashion jewelry. Be conscious that platinum could create an aging, which lots of people feel offers fashion jewelry a good antique appearance.

Unless you're giving your girlfriend a treasure ring, do not look for an engagement ring alone. Don't really feel pressured to buy something out of your rate range, however make certain you could find a ring that fits your future bride which she likes the ring. Why spoil the moment, by having to take the ring back for resizing or, also worse, just take it back?

If you're having a traditional wedding and also your household wants you to put on treasure precious jewelry, learn exactly what you will be wearing as early as feasible! You'll need to match your other products to what your family members will be giving you. Ensure you have sufficient time to snag a pair of jewelry or an arm band to match.

When you are checking out acquiring any sort of precious jewelry, be it outfit or vintage, it is necessary to bear in mind that just because a piece may be signed, it does not necessarily suggest it is better. Some precious jewelry developers sign every item they make, which drops the value of a signed piece dramatically.

To avoid breaking the chain of your locket, pair it with a necklace that matches it in weight. A thin necklace must just be put on with delicate beauties, and also hefty pendants should be conserved for thick, resilient chains that can take care of the stress. This suggestion likewise relates to charm bracelets.

To make certain your jewelry always looks proper, think about the occasion prior to picking pieces. Wearing precious jewelry ideal for the celebration will certainly keep you from looking out of area.

Try to deal with scrapes in watch glass prior to you squander cash at a jeweler. To fix this, attempt massaging a small amount of your tooth paste into the face of the watch.

Enable your filthy precious jewelry to soak for numerous mins and then gently scrub it with a soft toothbrush. End up the cleansing by rinsing your jewelry in clean water as well as permitting it to air completely dry.

In final thought, millions store for jewelry daily. There are so many different kinds of jewelry for individuals that it make buying for jewelry a little hard.


Every day, millions of people store for fashion jewelry. Many individuals buy jewelry, it is not constantly simple to go shopping for jewelry, as there are many different kinds for different individuals. The recommendations offered in this short article should aid you when you are shopping for fashion jewelry.

In conclusion, millions shop for jewelry daily. There are so lots of different kinds of jewelry for individuals that it make buying for jewelry a little challenging.

Also visit my blog :: anello con frase (http://www.anelloinciso.it)

LinqPad to AzureSQL (ActiveDirectory-Password authentication)

$
0
0
Hello,

I am successfully connecting to an Azure SQL instance every day and querying. I would like to leverage LinqPad Pro Edition (v5.31.00) for the same reason, but use an ObjectContext. However, I cannot connect to the Azure SQL no matter how I approach it with LinqPad. I am using SQL Azure as the Provider for the LINQ to SQL Connection, and Windows Auth (AD) for Log On details. I've tried using Advanced for a manually-specified connString, to no avail.

tcp:xxxxxxxx-sql.database.windows.net,1433

Is what I am doing possible yet in LinqPad?


Thank you,
Barry

Zombie Bug: Missing Method Exception

$
0
0
System.IO.Compression.ZipFile.Open("doesn't matter missing method exception", System.IO.Compression.ZipArchiveMode.Read)
-------

fails for file not found in C# (as expected)
in F# with the same references it gives a missing method exception, even though calling another method in the same dll works as shown in linked script below

extensive test linqpad script: http://share.linqpad.net/eufkg3.linq

using latest x86 beta 5.30.01
Viewing all 2658 articles
Browse latest View live