308 points · by wofo · 2y ago · 130 comments
I use LINQPad to manage my collection of snippets to do some ad hoc tasks on my machine. I also use it for testing out new code and learning about new features. It would be great when it becomes cross-platform, but last I heard Jo Albahari mentioned that the investment required was quite big and not worth it (at that time).
On the side note, I had a chance to see Jo Albahari's presentation few years ago in Sydney and I think he is unsung hero of .NET world (along with Ayende)!
One of the useful features is that it keeps the executable running even after the script has finished, and will re-execute in the same process.
This has some downsides and quirks (if you're not careful, you can double-initialize things like database connections), but has benefits for debugging.
The newer versions have "built in" support for Benchmark.NET too which is a really nice feature for quickly proving code.
But for Devops, build pipelines, etc. I prefer something a little more universally applicable and legible and that doesn't require a runtime. So bash is usually my approach there. Sometimes PowerShell if I know I'm going to be running it on a Windows box anyway.
Much as I love C#, if I came into an environment and all the Devops/CI/CD was done using Linqpad and lprun I'd immediately wonder what in the actual fuck I had gotten myself into, lol.
I am glad that the UX people haven't gotten around to mess it up yet.
[1]: https://winmerge.org
(though I end up disabling it to reduce extra pressure on language server when it's unneeded)
radios.GroupBy(x=> x.Channel).Select(x=>x.OrderBy(y=>y.Price)).Select(x=>x.First());
If I remember correctly, it also let you compare the LINQ query against the transpiled SQL so you could try to hand-optimize it a bit as well.https://forum.linqpad.net/discussion/1935/installation-on-ma...
It's not as good as LINQPad, but it runs on the Mac.
Notice a common theme here? Literally zero ways to browse C# syntax trees available on the Mac. Nothing in the cloud either from what I could find. Roslyn was open-sourced in April 2014, which was 122 months ago. (edit: Another commenter pointed out that there is in fact a new VS Code extension that can do this, released Aug 2023)
By the way, you can't get autocomplete either while interactively debugging C# outside of Windows. The debugger is proprietary. Maybe there's a way, but I haven't found one.
Syntax trees can be browsed on https://sharplab.io/ or again via Rider and I'm sure there are some other tools that I'm not aware of.
The Roslyn sdk is part of .NET (cross platform) these days so anyone can use it to build a visualiser should they wish to.
Also, autocomplete works in VS Code debug tab just fine?
Please stop trying to make the windows point.
Literally zero? I can count 2 from the top of my head.
Even Microsoft themselves understood this.
Half of Stack Overflow "developers" might not use Windows, but the relevant population to measure is C# developers.
Assuming as many Linux C# developers will buy the thing as Windows or MacOS developers do is an obvious mistake.
> Even Microsoft themselves understood this.
Microsoft understands, among other things, that they can't charge money for Linux tools.
In particular, keyboard shortcuts to toggle visibility on the different sub-windows, and using the Util class to prompt for a password I find to be useful.
I used to purchase premium version (single user) and the upgrade option is $97.50 instead of $125 for new license.
Major version are: LINQPad 2, 4, 5, 7 and 8. The official page seems to disagree. There is nothing about LTS.
Sure, I can skip 7 and wait for 8, but that kind of defeats the purpose.
I’m not against it, I just don’t need it
The database integration is also great and allows me to write ad-hoc SQL queries using LINQ.
Essential LINQPad productivity features for me include:
1. Flexible visualization tools with sensible defaults and one-click export.
2. Ability to easily round-trip copy/paste code snippets between LINQPad and external IDE projects with minimal fuss (e.g., no boilerplate required for expressions, statements, or simple functions).
3. Automatic reloading of libraries I'm working on externally in an IDE with minimal IDE rebuild interference.
3. Completion on par with VS.
4. One-click document cloning.
5. NuGet integration, including the ability to search for and update referenced packages.
6. A simple, built-in debugger.
A typical LINQPad workflow for me (excluding tasks like writing documentation and unit tests for brevity):
1. Start with a task of accessing or exporting data from either a set of files in an unknown format or from an application — ideally, but not always, a Web application — without a documented API.
2. Create a library project in Rider or VS and a LINQPad document referencing the library.
3. Investigate the files or application interactively using LINQPad and other tools (hex editors for investigating binary formats, jq/IPython/PowerShell for JSON and XML, browser dev tools for Web apps, accessibility tools when automating Windows desktop apps, etc.).
4. Add data access mechanisms to the library.
5. Repeat steps 3 and 4 as necessary, with more and more work being done in LINQPad via the library on each iteration.
6. Build simple command-line or graphical tools on top of the library to allow non-programmers to access or export data from similar systems in the future without LINQPad. In cases where non-UI logic in these tools becomes non-trivial, I'll typically prototype this logic in LINQPad and extract it into a library, as well.
Finally, as new requirements arise, I can load up existing libraries and LINQPad to analyze and prototype solutions, often leading to initial results delivered to customers in minutes rather than hours.
{ "file_patterns": ["*.cs"], "cmd": ["dotnet-script", "$file"] }
Nowadays, I am looking for a notebook style editor (like jupyter notebook) that supports dotnet well and works with VS Code. I tried Polygot notebook a while back, but it kept crashing, so I un-installed it.
Unfortunately the DB was SQLServer Compact 3.5 and for whatever reason LINQPad couldn't find the required assemblies to open it which was a shame
Products which would cost Microsoft absolute peanuts to acquire. Or even just use that as a model and rip it off entirely with an in house version.
So in the end it's good all those tools stay independent and focused.
Unfortunelly WinDev and XBox[0] only cares about C++ and COM nowadays, after they won over the whole Longhorn drama.
[0] - Managed DirectX and XNA were projects pushed by key engineers, folded after they weren't any longer around to argue for their projects.
I often find it quicker/less frustrating to just fire up a new console app project.
Last time I tried to use it I think it was even running an old version of .Net and you have to remember to switch the version.
Including login and etc.
Linqpad is great
You can make your own driver as well as use about a dozen of other drivers.
By being Windows only, it conveys "toy" status. Professional database engineers don't use non-Linux, hence I can infer professionals don't use this.
What makes Linux uniquely appropriate for database engineering? Why not *BSD? What OS do you think engineers working with Microsoft SQL Server use?