r/csharp • • 18h ago

C# file-based apps are a breath of fresh air

123 Upvotes

Back when .NET 10 came out I didn't pay much attention to the file-based apps. Now that .NET 11 came out i stumbled upon this video and became more interested:

https://www.youtube.com/watch?v=Yvn7liNioto

Turns out file-based apps are pretty cool after all. The minimalistic developer experience of having only your text editor, your .cs file(s) and the dotnet cli feels fresh after working so long with solution files, project files and all that jazz.

To get a feel of the DX and where the capabilities of file-based apps are at the moment I created this tongue-in-cheek todo web app, with the frontend and backend in a single C# file. File-based apps and minimal APIs are like meant for each other.

https://github.com/TDMR87/single-file-todo-app

I do hope file-based apps become more common and the dotnet team would lean more on this kind of experience. Together with AOT compiling native executables this could make C# more popular and invite people over to the ecosystem. How do people here feel about these file-based apps? Do they have a future?

https://learn.microsoft.com/en-us/dotnet/core/sdk/file-based-apps


r/csharp • • 9h ago

News C# just beat SolidJS and Vue 3.6 Vapor in WebUI!

68 Upvotes

I was checking the official JS Framework Benchmark keyed table today and had to do a double take.

For years, C# in the browser meant Blazor sitting near the very bottom of the leaderboard. Today, NetWasm.UI (netwasm-ui-v0.16.0), a garbage-collected C# framework, is sitting to the left of Vue 3.6 Vapor, SolidJS, Leptos, Dioxus, and Sycamore.

Every rule we were told about WebAssembly being too slow for the DOM, or needing Rust to avoid GC overhead just got broken in one shot.

Huge congrats to Mat Engo and the NetWasm team on an insane piece of engineering.


r/csharp • • 4h ago

Tool I built a reactive notebook for C#, and it now runs inside VS Code

Post image
20 Upvotes

i've wanted a proper notebook for C# for a long time now. Polyglot Notebooks is fine but I kept wishing for 2 things. cells that re-run when something they depend on change, and a file i could just open in any editor and actually read

so I built it lol. its called Reverb, open source (MIT) and the VS Code extension is out today

what is it

a notebook is just a normal .cs file. you separate cells with // %% comments like this:

csharp

// %%
var sales = LoadSales("data/sales.csv");

// %%
var byRegion = sales.GroupBy(s => s.Region)
                    .Select(g => new { Region = g.Key, Revenue = g.Sum(s => s.Amount) });
Display(byRegion);

edit the first cell and second one re-runs on its own, kinda like a spreadsheet. It uses Roslyn to analyse your code and figure out what depends on what so you dont have to wire anything

also because its just a .NET 10 file based app this works too with only the SDK:

dotnet run sales-explorer.cs

no Reverb install needed. I have CI checking this on every build because i didnt want it to be one of those claims that quitely stops being true after some time

in VS Code

notebooks open as native VS Code notebooks (normal cells, run buttons, outputs) but with the reactive engine underneath. you also get

  • charts, tables and interactive widgets like sliders in the output
  • dependency view so you can see which cell feed which
  • quick fixes for common issues
  • packages view for nuget references
  • lazy mode - it marks dependents stale instead of re running them, good for the expensive cells

it talks to the reverb tool over stdin/stdout so it dont open any network port. and if the folder is not trusted it wont start a kernel or restore packages

try it

where its rough

its still young (0.2.x). only vs code for now, havent done open VSX/VSCodium yet. I tested on windows, macOS and linux but im sure you guys will find stuff i didn't. bug reports and "this is confusing" feedback is honestly the most useful thing you can give me

would love to hear what you'd want from a C# notebook :)


r/csharp • • 2h ago

dotnet-vulncheck: transitive vulnerable packages scanner

Post image
2 Upvotes