r/dotnet • • 12h ago

Native UI framework XML prototype with Win32

Thumbnail gallery
1 Upvotes

For those who remember my post about new C# + XAML/XML-like UI, I decided to build the core in C++ (so I can call NDK in Android, other OSes)

Anyway. This here calls Win32 UI components (1st screenshot defaults to Win95/98, 2nd takes on UxTheme of OS im on so Windows 10).

I'll expand on OS-drawn components as much as I can, and for everything else use Canvas to draw things like WinUI does. Devs will get a choice what they want to use (obviously pure Win32 will have limited choices).

I haven't yet figured out if I can mix-and-match native + Win32, but native would just be boxes of canvas anyway so once layout if calculated we could probably allow that, but I'll see

Anyway. The UI framework will be messy (lots of ways to do 1 thing) but at least devs will have all the choices to make their programs look however they want!

Last post for those interested: https://www.reddit.com/r/dotnet/comments/1xtaerv/new_cxamlish_ui_framework_in_planningstage_inputs/

PS: this is my play-project after work hours, so don't expect lightening fast progress -.-


r/dotnet • • 2h ago

miPDFlib – an Apache-2.0 PDF library for .NET: PAdES signatures without BouncyCastle, PDF/A, PDF to Markdown, pure managed code

0 Upvotes

I maintain miPDFlib, an open-source PDF library for .NET 8 and 10: Apache-2.0, pure managed code, no native binaries, and the only dependency is System.Security.Cryptography.Pkcs. (It's my project, so read this as the author's view.)

Some background: I've worked on electronic signatures since 2003, and in every project the PDF part meant iText (AGPL or commercial) or another commercial library. I wanted something I can ship in closed products without a licence key or a revenue limit.

**What it covers**

- **Create and edit:** a layout engine with paragraphs, tables (repeated headers, spans, rows split across pages), lists and page breaks; TrueType/OpenType subsetting; Arabic, Hebrew and Indic scripts; merge/split, forms, annotations, layers, AES and certificate encryption

- **Sign and verify:** PAdES B-B to B-LTA with time-stamps and OCSP/CRL, HSM and cloud signers, two-step signing – built on .NET's own cryptography, no BouncyCastle. Verification checks integrity, the certificate chain at a time proven by a trusted time-stamp, and what was changed after signing.

- **Archive and invoice:** PDF/A-1b to A-4, PDF/UA-1 and -2 (the layout engine tags as it goes), ZUGFeRD / Factur-X / XRechnung

- **Read:** words, lines and letters with positions; reading order across columns; layout analysis (headings, lists, tables with cells) with export to Markdown, hOCR, ALTO and PAGE; an option to get only the text a reader can see, so white, hidden or covered text doesn't end up in your LLM prompt; real redaction

- **Optional packages:** miPDFlib.Rendering (pages to PNG) and miPDFlib.PostScript (PostScript/EPS to PDF), also managed code only

// create

using var pdf = PdfDocument.Create();

using (var layout = new LayoutDocument(pdf, PageSize.A4, new Thickness(50)))

layout.Add(new Paragraph("Hello r/dotnet", PdfStandardFont.HelveticaBold, 20));

pdf.Save("hello.pdf");

// sign (PAdES with a time-stamp) and verify

byte[] signed = PdfSigner.Sign(File.ReadAllBytes("hello.pdf"), CertificateSigner.FromPfx("me.pfx", "pw"),

new PdfSignatureOptions { TimestampClient = new HttpTimestampClient("http://timestamp.digicert.com") });

foreach (var result in PdfSignatureValidator.Validate(signed))

Console.WriteLine($"{result.FieldName}: intact {result.IsIntegrityValid}, level {result.Level}");

// PDF to Markdown for a RAG pipeline: columns, headings, tables, no running heads

using var doc = PdfDocument.Open("report.pdf");

string markdown = PdfLayoutExport.ToMarkdown(doc);

**How it's tested.** I'll say it up front because it always comes up: I wrote it from the public specs (ISO 32000, the ETSI PAdES standards) with a lot of AI assistance, so most of my time went into checking the result. 887 unit tests; PDF/A and PDF/UA output validated with veraPDF, signatures with the EU DSS validator, rendering compared with Ghostscript, and runs over a corpus of real-world PDFs. There's a published security audit against OWASP ASVS and the known attacks on PDF signatures (universal signature forgery, incremental saving, signature wrapping, shadow attacks), CodeQL on every push, and a mutation fuzzer that feeds it 40,000 new damaged documents every night. How the AI part went: https://www.mitterbucher.com/en/articles/mipdflib-aipdflib/

**What it doesn't do:** convert HTML or Office files (LibreOffice via Gotenberg works well for that – sign or post-process the result with miPDFlib), OCR, or commercial support. The layout analysis is heuristics, not a vision model. And it's young: the first public release was at the end of October 2026; the API has been stable since 1.0. My own signing products run on it in production, so it will be maintained.

- GitHub: https://github.com/Mibuw/miPDFlib

- NuGet: `dotnet add package miPDFlib`

- Docs: https://mibuw.github.io/miPDFlib/

- Comparison with iText, Syncfusion, PDFBox, PdfPig, PDFsharp and QuestPDF, including where they're ahead: https://github.com/Mibuw/miPDFlib/blob/main/docs/COMPARISON.md

I'd appreciate feedback on the API, and most of all PDFs that break it – or a synthetic copy of the layout if the real one is confidential.


r/dotnet • • 20h ago

Promotion What actions have you made for Post-quantum cryptography (PQC) in your .NET app?

0 Upvotes

Considering NSA Advises Immediate Transition to Post-Quantum Cryptography to Protect National Security Systems, I had some code that signs responses with Elliptic Curve Digital Signature Algorithm (ECDSA), and well... NSA thinks that's unsafe now.

The following GitHub commit shows how you can implement RFC 9964: ML-DSA for JSON Object Signing and Encryption (JOSE) and CBOR Object Signing and Encryption (COSE) into ASP.NET Core middleware to create JSON Web Signatures (JWS):

introduce RFC 9964: post-quantum ML-DSA-65 (FIPS 204) signatures for … · erwinkramer/bank-api@66463c8

What actions have you made, or what actions are you going to make in this new world?


r/dotnet • • 20h ago

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

Thumbnail reddit.com
0 Upvotes

r/dotnet • • 4h ago

Promotion dotnet-vulncheck: transitive vulnerable packages scanner

Post image
13 Upvotes

dotnet vulnerable packages scanner, extends
dotnet package list --vulnerable --include-transitive
by adding the missing information for vulnerable transitive packages which is: which dependency brings them in.
github: https://github.com/almegdad/dotnet-vulncheck


r/dotnet • • 2h ago

Promotion OneApp 1.1: html/css apps in c# with zero third-party dependencies, on Windows, macOS, Linux, iOS, Android and the browser

3 Upvotes

OneApp is a cross platform .NET app framework with zero third party dependencies. Your app depends on .NET and our own packages and nothing else.

It's not a web view wrapper and there's no Chromium, Skia, HarfBuzz or FreeType underneath. Every layer is written from scratch in c#, from the html parser and css layout to font loading and text shaping, image decoding, the shader compiler, the Vulkan and Metal renderers (with a CPU rasterizer as a fallback) and the accessibility bridges for each OS. The binary calls the OS windowing, input and graphics APIs directly.

You build the UI as html/css components with a c# class behind each one, and bindings, events and css properties get checked at build time. The same components run as NativeAOT apps on Windows, macOS, Linux, iOS and Android, and in the browser on wasm.

A dotnet new oneapp app lists 20 packages and all of them are RecursiveAI.*. The linux-x64 publish is a single 22 MB executable. The same test app on dioxus-native (Blitz) pulls in 426 crates.

Debug builds also expose an MCP server, so a test or a coding agent can click, type, read the DOM and grab pixels from the running app. In the demo video (recursiveai.org/oneapp/) an agent finds a layout bug, fixes the css, hot reloads it and checks the pixels to make sure it's actually fixed.

MIT/Apache-2.0. Code is at github.com/recursive-ai-oss/oneapp-csharp and you can try it with dotnet new install RecursiveAI.OneApp.Templates


r/dotnet • • 6h ago

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

Post image
7 Upvotes

r/dotnet • • 11h ago

Promotion Lazy Sequence Generator: Bronskiy.Sequences

0 Upvotes

Hi, everyone!
I've been working on Bronskiy.Sequences, a small NuGet library that allows you to generate lazily evaluated sequences from functions.

Code example

using Bronskiy.Sequences;
    
// Index based generation
IEnumerable<int> oddNumbers = Sequence<int>.Generate(1, 5, 2, index => index); // 1, 3, 5, 7, 9
    
// Seed based generation
IEnumerable<int> powersOfTwo = Sequence<int>.Iterate(5, 1, value => value * 2); // 1, 2, 4, 8, 16 
IEnumerable<string> words = Sequence<string>.Iterate(3, "a", value => value + "a"); // a, aa, aaa

I would appreciate it if you could review the API of the library or suggest new features!

Links


r/dotnet • • 25m ago

I got tired of writing every Interactive Auto service 3 times, so I built a source generator for it (Blazor.AutoGen 1.0)

Thumbnail reddit.com
0 Upvotes

r/dotnet • • 2h ago

Eu construí uma cascata de swap de código aberto para WSL2 que usa a VRAM ociosa da GPU como um cache de leitura comprimido na frente de uma origem NVMe (via AF_VSOCK e /dev/dxg, sem TCP)

Thumbnail reddit.com
0 Upvotes

r/dotnet • • 3h ago

Promotion FinallyForms 0.12: I just wanted a WinForms Properties splitter that stays put. Things escalated.

0 Upvotes

It all started with a tiny, almost silly thing. Every time I went back to the Properties window, its splitter had slid almost all the way to the right, and I had to drag it back to the middle. Again. And again. And again.

That was just annoying, though. What I really dreaded was opening a form and finding an exception where my controls should be. "What did I break this time? And how on earth do I fix it?" I don't know about you, but that one seriously freaks me out.

One day I'd had enough and decided to build my own little designer. It went great – my shiny new splitter never moved a single pixel without my permission. But then things escalated – the ideas kept coming. One after another (even in pairs, sometimes). And I just couldn't resist – I stuffed them all in.

Somewhere along the way I polished it so much, and grew to love it so much, that I thought other people might like it too. So I made a website for it, and now I'm putting it out there for anyone who suffers the way I did.

A few things I personally love most about FinallyForms:

  • All my forms at once – live thumbnails of every form in the project. When I'm looking for a form I can polish a bit more, this gives me a quick overview. Just a gimmick, some might say. Maybe – but a pretty one.
  • The eyedropper – I click through the running app, deep into its guts, so deep I don't even know where I am anymore. But the eyedropper knows, and one click shows me that control in the designer. Good eyedropper!
  • All the texts – every text on a form, or in the whole project, with search, replace, export, import and translations. What more could I want?
I really didn't know when to stop – and I haven't stopped yet. My idea list is still pretty long.

FinallyForms is a standalone app for Windows 10 and 11 that works on your existing .Designer.cs files (.NET Framework 4.8 and .NET 8+), and it opens your forms right from Rider, Visual Studio or VS Code. Version 0.12 is out, and it's free during the beta: https://finallyforms.dev After 1.0 it will be paid, with a 30-day free trial.

And what's the one feature you've always wished a WinForms designer had? Let me know – my idea list always has room for one more. If you actually take it for a spin and send useful feedback (a bug, an idea, or something you're missing), I'm giving a free 1-year license of 1.0 to the first 50 testers, one per person. Just use Settings → About → Send Feedback in the app.

P.S. About that exception from the beginning: when a control can't be created, FinallyForms puts its nearest base type in its place, the rest of the form keeps working, and a Check tells you which control failed, why, and where. And forms built on generic base classes? They simply open – no workaround class needed.


r/dotnet • • 7h ago

Promotion Microservices or monolith: should that decision live in your code at all? How do you handle it?

0 Upvotes

How do you decide when a module gets its own service, and how often did you have to undo that decision later?

I keep running into the same pattern. A team splits a monolith, ends up with a distributed monolith, and spends a year merging things back (Segment's "Goodbye Microservices" is the famous one). Or a team stays monolithic, and when one part really needs its own process, extracting it is a rewrite.

The best explanation I have found is a Google paper, "Towards Modern Development of Cloud Applications" (Ghemawat et al., HotOS 2023): microservices mix two boundaries. The logical one, how the code is structured, and the physical one, how it is deployed. While they coincide, every "let's split" or "let's merge" is a code change. Google's own answer, Service Weaver, went into maintenance mode in 2024, partly because adopting it meant rewriting existing apps.

What we do (disclosure: the runtime is my own open source project, redb.Tsak, Apache 2.0):

  • code is cut into modules along DDD bounded contexts, and a context never spans packages;
  • which module runs in which process is configuration: one worker with every package is a modular monolith, one package per worker gives you microservices, a cluster of workers adds failover;
  • inside one process modules talk through an in-memory queue; when one moves out, the address in config changes from vm://orders to rabbitmq://orders or kafka://orders, and the route code stays the same.

We run all three shapes in production: one project as six packages on four workers talking through RabbitMQ (a test fails if a module references another module directly), one as a single worker with two modules, one as a three-node cluster.

What it does not solve, and I would like to hear how you deal with these:

  • modules in one process share failures: a memory leak in one hurts its neighbours;
  • a call that was synchronous inside a process stops being synchronous over a broker, so modules that might move apart should talk asynchronously from day one, which costs something even if they never move;
  • a shared database is convenient while everything sits together, so we only let the owning module write to its schemes.

So, questions for you:

  • What makes you carve out a service: team, load, security, domain?
  • Do your service boundaries follow bounded contexts, or did they grow on their own?
  • Have you merged services back, and what pushed you to do it?
  • How do you debug a chain of several services on your own machine?

Repo: https://github.com/redbase-app/redb-tsak


r/dotnet • • 10h ago

BlazorDX 0.7.0 Released

Thumbnail blazordx.com
2 Upvotes

r/dotnet • • 18h ago

Promotion Runtime async in WASM is now available via NetWasm v0.16 (1.5x faster than Desktop JIT)

43 Upvotes

https://github.com/zion-sati/NetWasm

Been a month since I last updated here and a lot of improvements have gone into NetWasm. Let's start with a little intro for those who are new.

NetWasm compiles C# straight to one standalone WebAssembly file: no Mono, no dotnet.js, no CLR inside.

Version 0.16 compiles .NET 11's runtime async, which Microsoft's own WebAssembly runtime can't run yet, and on async workloads it beats desktop .NET.

Runtime async, in WASM, before Microsoft

For as long as C# has had async, Roslyn has turned every async method into a state machine class: fields for every local, a MoveNext switch, a builder. .NET 11 changes that. With runtime async, the runtime itself suspends a method and resumes it in place, and the compiler emits the method almost as written.

On .NET 11, Blazor WebAssembly runs on Mono, and Mono can't run runtime-async methods (https://github.com/dotnet/runtime/issues/137984). NetWasm 0.16 compiles every async method in your project with runtime async, .NET's own libraries included, on its own suspension runtime, in the browser and under WASI.

NetWasm async faster than desktop .NET

I measured 23 async scenarios in three groups. The first is async patterns: awaits, Task.Yield, WhenAll, IValueTaskSource, async iterators, and exceptions thrown ten frames deep. The second is CoreLib's own stream loops and SemaphoreSlim. The third is libraries: System.Text.Json over a stream that suspends on every read, pipes, channels and DeflateStream.

Share of the other runtime's time NetWasm takes (geometric mean, lower is faster)Mono AOTDesktop .NET 11 JITDesktop .NET 11 NativeAOT
Async patterns (11)0.090.490.57
CoreLib streams, SemaphoreSlim (6)0.310.840.98
JSON, pipes, channels, Deflate (6)0.390.801.14
All 230.180.640.79

This is all a fair fight. Desktop runs runtime async too: its libraries ship compiled that way, and the benchmark turns it on for the workloads' own code. The desktop JIT runs with tiering off, so both sides run optimized code from the first call. The numbers are medians of 15 runs on an Apple M1 Max, with NetWasm under Wasmtime.

NetWasm doesn't win everywhere though. It beats the JIT in 15 of the 23 scenarios and NativeAOT in 13. On JSON, pipes, channels and Deflate, NativeAOT's still ahead.

For more details, see https://www.netwasm.com/micro-benchmarks/ (filter family by Async workloads)

Avalonia 12, unmodified

While runtime async is the headline, the bigger change for anyone shipping an app is that NetWasm now compiles packages you find on nuget.org.

Some of you here have requested for this specifically -- Avalonia 12, with Skia, compiled XAML and the Fluent theme, compiles straight to WebAssembly with no changes to Avalonia. Its headless platform renders the same frame as desktop .NET, pixel for pixel, on wasm32 and wasm64, in Debug and Release. SkiaSharp and HarfBuzzSharp ship native static archives for .NET's WebAssembly SDK, and those link into the program exactly as they ship. Multi-assembly Avalonia applications compile too.

A NetWasm project targets net10.0-netwasm, a .NET platform target framework like Blazor's net10.0-browser. NuGet restores each package's normal `net10.0`, `net8.0` or .NET Standard build, so a package doesn't need a NetWasm build of its own.

I took the 100 most-downloaded nuget.org packages that ship a .NET Standard build and ran each one's README quick start. 56 run unchanged. Most of the rest stop on run-time reflection, which NetWasm leaves out on purpose. Several of those have a source-generated replacement that works.

First to WASI 0.3 ahead of Rust

NetWasm targets WASI 0.3, so the same compiler builds backend services. A project can read files, open sockets, and serve HTTP that wasmtime serve, Spin and wasmCloud run as-is. SslStream runs over wasi:tls, so HttpClient does pooled HTTP/2 over TLS, and wss:// WebSockets work. The HTTP service template, with .NET's whole HTTP stack, is a single 1 MB component, 251 KB with Brotli.

Debug it by C# line

A Debug build now carries DWARF. When a Wasmtime run traps, the backtrace names your C# frames as App.Program.Fail at Program.cs:17. LLDB under Wasmtime sets breakpoints on C# lines and steps through them.

Still small, still fast

The template app that prints 42 publishes to 26,444 bytes, precise GC included. Rust's size profile builds the same WASI 0.3 component at 63,528. Across 2,389 micro-benchmark cases, from dotnet/performance and NetWasm's own, NetWasm runs more than three times as fast as Mono AOT on the same Wasmtime. David Fowler's DoomSharp renders about 1.4 times as fast as its Blazor AOT build, from a ninth of the download.

Thank you to this amazing subreddit

Thank you all for shaping NetWasm as a product and providing me with a lot of useful pointers such as using SatoriGC, testing it out and filing bug reports. Please continue to do so! I'm very grateful and highly value all your feedback.


r/dotnet • • 2h ago

Promotion Not your usual .NET project, a tiny café living in the Windows taskbar (C#, .NET 10 and Avalonia) who said .NET is only for enterprise?

Post image
140 Upvotes

not the usual .NET project, but figured some of you might enjoy it :) I built a tiny cozy café that lives on the Windows taskbar.

I'm a .net software engineer who spends most of his time working on corporate software.

stack is C# on .NET 10, Avalonia for the UI and CsWin32 for the Win32 bits. The trickiest part was keeping it on top of the taskbar without flicker lol, and going away when there's something full screen.

gameplay loop is chill, customers walk up, the barista makes coffee, it rains or snows, and you run the business all from a small panel. you invent drinks, put them on the menu, upgrade your equipment, etc.

Little Window Café on Steam, coming out in a few weeks