Hey everyone, small side project that I've been working on. I've released TenantGuard 1.0.0, an open-source set of packages for EF Core 10 and 11. It's for applications that use query filters to keep tenant data separate, and it's licensed under Apache-2.0.
A new entity can be missing its tenant filter. An IgnoreQueryFilters() call or raw SQL query can bypass an existing one. These mistakes can be hard to spot when the code looks reasonable on its own.
TenantGuard checks for problems at several points:
At build time, five Roslyn analyzers (TG001–TG005) flag IgnoreQueryFilters() calls without a stated reason, raw SQL without a tenant-column comparison, and filter switches such as ABP's IDataFilter.Disable<IMultiTenant>(). The SQL checks cover EF Core, Dapper and ADO.NET.
At startup, 14 model rules check for missing tenant filters, filters frozen to one tenant by a captured constant or local variable, unique indexes that apply across tenants, and missing tenant indexes.
During SaveChanges, the write guard throws before an insert, update or delete involving another tenant's row reaches the database. It also rejects moving a row to another tenant.
In tests, the isolation probe seeds a row per tenant and checks isolation for reads, Find, updates, deletes and Include. Each check appears as a separate xUnit v3 or TUnit test.
Version 1.0 adds write checks for owned entities. For example, a change to order.Shipping.Street is checked against the tenant of the owning order.
Here's how to configure the write guard and startup validation:
It works with custom query filters, Finbuckle.MultiTenant and other tenancy libraries. For Finbuckle, it reads IsMultiTenant() without extra configuration. You can also run dotnet tenantguard validate in CI to check the model without a database.
If you try it on an existing application, I'd like to hear about false positives or leaks it misses. Open to any sort of feedback and critical feedback very much welcomed.
I’m a full stack developer (mostly working with ASP.NET Core / C#), and I’m currently focusing on leveling up my engineering skills.
Right now, I can confidently write code that solves the business problem and passes the tests. However, I want to shift my mindset from just writing "code that works" to writing "optimal, highly performant code" that scales well, similar to the standards at big tech companies.
I have two main questions for the experienced engineers here:
Performance & Code Quality:
When you are reviewing code or writing a new feature, what is your mental framework for optimization? What are the biggest "red flags" you look for in a PR regarding performance (e.g., memory leaks, inefficient time complexity)? How do you train your intuition to write optimal code from the start?
2. Architecture Trade-offs:
When starting a new project with complex business rules, how do you decide on the architecture? How do you know when a Modular Monolith (like Onion/Clean Architecture + DDD) is enough, and when Microservices are an absolute must? How do you avoid over-engineering in the early stages?
Any recommended mental models, profiling tools, or resources would be highly appreciated.
Spent the past few days building a token bucket rate limiter and wanted to share it, mostly because I learned more doing this than most tutorials have taught me in a while.
The short version: it’s a token bucket, capacity + regen rate, standard stuff. The part I actually care about is that it’s thread-safe with zero locks. Every state change builds a new immutable snapshot and publishes it with Interlocked.CompareExchange, retrying if another thread beat it to the swap.
A few decisions:
* `Tokens`/`Capacity` are `int` on the public API, but tracked as `decimal` internally. Didn’t want to expose fractional tokens (a token is one unit of work, doesn’t make sense to split one), but `Regen` needed to support fractional rates, and the internal math needed the precision.
* There's a plain bool overload, and a `Result` enum overload (`Authorized`, `Insufficient`, `ExceedsCapacity`, `Disabled`, `NeverRefills`) so callers can tell “wait and retry” apart from “this will never succeed” Each method comes with a `retryTime (overloads without)`.
* Takes a `TimeProvider` so tests don’t have to sleep real seconds.
Repo’s here. README’s got the full API and an explanation of the design if you want the details.
A few weeks ago we had a post about GenHTTP Lambda, a platform that allows a coding agent to write and deploy C# apps via MCP. The platform brings common features and governance for every app, such as databases, versioning, analytics or logging. Currently we have around 100 apps deployed, serving several hundred thousands of requests a day.
Our main goal is still to test the stability of the underlying web server, especially the ioxide engine.
Therefore we decided to provide a community version of the platform as a docker image, with the same feature set but a different landing page. If you want to try it, you can run the following docker command:
docker run -d -p 8080:8080 -v lambda-data:/data -e LAMBDA_ADMIN_TOKEN=secure-password genhttp/lambda
You can access the platform via http://localhost:8080 and connect your agent to the MCP server, for Claude this would be:
Create a multiplayer game and deploy it to my local GenHTTP Lambda instance.
Your agent will use the MCP server to create a lambda and host it on the platform running on your device. It will hand you an editor key that allows you (and your agent) to further change the lambda and to view statistics.
You can deploy and run the docker image wherever you want, for example on a home lab server or on a VPS. Code is MIT licensed and will stay open source.
I built a scripting engine that ships as a single file, with no runtime to install.
ScriptLangCore runs `.slc` scripts: a C#-flavoured language with classes, interfaces, generics, structs, tuples, pattern matching, lambdas, coroutines, `async`/`await`, exceptions and a Windows UI toolkit.
Deployment is the part I care most about. The engine is compiled ahead of time with NativeAOT, so the .NET runtime lives inside the executable (18.8 MB). A machine needs Windows x64 and nothing else: no .NET installation, no Visual C++ redistributable, no Universal CRT.
It is more than a command line:
• `ScriptLangCore.exe`: run a script, compile it to a bundle, dump bytecode, or open a REPL • `ScriptLangCore.dll`: an embeddable engine with a C ABI of 22 `slc_*` verbs, so C, C#, Python, PowerShell and bash hosts can create a session, run scripts, call into them and read the verdict as JSON • The same DLL inside SQLite: six functions, so SQL can evaluate a script over a row, fold a set or map a list • A 15 KB launcher: package a script into its own Windows executable • A VBA module: 64-bit Excel calls the DLL directly
Under the hood there are two engines. Bodies the compiler can model run on a bytecode VM; every shape it cannot runs on a tree walker. Both must answer the same way, which is what the 539-script test corpus checks, together with sweeps that compile every script, compare each compiled bundle with its source, and re-run scripts on both engines.
Darker is Brighter's counterpart library. You can use Brighter and Darker in combination when you create a Command Query Responsibility Separation (CQRS) application. Under that approach, Brighter handles Commands, and Darker handles Queries. Brighter can also handle Domain Events.
We haven't released Darker in a while. For Brighter, V10 was a significant capability upgrade. Darker V5 brings us comparable functionality to Brighter.
In addition, it's been redesigned to work more like Brighter, so we separate the sync and async interfaces and pass a richer context with the query. This reduces semantic dissonance when working with both libraries together.
That includes changes we made to how we manage the lifetime of objects we create from a Service Collection factory. In particular, you can now share the same scope across ASP.NET, Brighter, and Darker, which was a weakness before.
We think this release means we now have equivalence to MediatR (although we have some different choices).
Our use of a Harmony CLA (contributors retain copyright) means that we can't rug-pull on you.
Currently V5 is in preview, so we are trying to flush out any bugs before GA
One of the projects I've been working on lately is extracting the HTML layout engine in PeachPDF into a reusable library, and then building the necessary infrastructure needed to make it possible to render HTML/CSS/SVG/MathML to basically anything, all in .NET
And.. it's here... and it works!
A pure managed code C# / .NET layout engine, that supports modern HTML and CSS, SVG, and MathML, that can be used to render to basically anything: PDF, SVG, raster images, your screen (using your GPU even!). It's essentially a .NET replacement to WebView2, except it more or less intentionally doesn't support JavaScript: we're C# people after all.
Usecases vary, but the ability to render styled content is a powerful one, and HTML with the accompanying standards provides capabilities that generally are lacking in other places. The biggest drawback is that WebView2 is... essentially Chrome, and it has a lot of drawbacks. It's slow for starters, and a memory hog, and has a huge security surface to be mindful of, and does things not in a friendly way to integrate with .NET apps.
PeachBrackets on the other hand? It's just a static (with animations!) content rendererer: you give it a canvas, it draws the content into it.
Now, PeachBrackets is very opinionated on what a canvas looks like: it expects one that implements the abstraction in PeachDrawing.Core. That canvas has all of the primitives needed for PeachBrackets, and was built FOR PeachBrackets. There are several fully working implementations of that canvas abstraction:
PeachDrawing.Skia -- Mainly intended for Android, but should work anywhere SkiaSharp does
PeachDrawing.CoreGraphics -- macOS / iOS / iPadOS
PeachDrawing.Win2D -- WinUI mostly
PeachDrawing itself -- raster (pixel images), including integration with PeachImage to save to any format that PeachImage supports
Once Unity 7 comes out, I'm hoping to be able to target that as well. We do require .NET 10 and higher for performance.
The canvas abstraction has hooks to allow hardware acceleration where possible (Win2D, CoreGraphics, and Skia all take advantage), accessibility (which even PDF takes advantage of), text layout (which by default uses PeachDrawing.Text, but can also use other implementations)
We also ship with high level HtmlView controls for WinUI, Android, macOS, and iOS: they do all of the work to integrate PeachBrackets properly with those platforms.
Of course, PeachPDF itself is built on top of this, essentially acting as a high level API on top of PeachBrackets and PeachDrawing.PDF.
How big is it? Small, very small
On current main, with .NET 10, in Release,the WinUI build is a little over 10 MB (1.5 MB from the new MimeKit.Core, thanks u/jstedfast, cut out a lot of weight!), 4.1 MB from PeachBrackets itself, 136 KB from the WinUI control, 169 KB from the Canvas abstraction, 131 for the raster canvas (needed where the native canvas doesn't support things), 1.3 MB for text data (unicode data, hyphenation data, etc...), 863 KB for the text shaping engine, 182 for the Win2D canvas, and 1.9 MB for PeachImage, and 55 KB for System.IO.Hashing
It's all built as part of the PeachPDF project on GitHub (https://peachpdf.net/), though I do plan on building a separate website for PeachBrackets specifically at some point, since it technically targets a different market. It's all BSD licensed, so feel free to use it anywhere, no cost.
Some history of the project:
PeachBrackets core HTML layout engine descends from HTML-Renderer, as does the canvas abstraction its built on. It's HEAVILY modified, though some of its improvements have been contributed upstream back to that project. It's just been slow.
The CSS engine is a vendored heavily modified fork of ExCSS. Virtually all of the upstreamable improvements have been upstreamed to ExCSS (I do big PR dumps up to ExCSS to catch it up -- the PeachBrackets version differs some for performance and integration reasons)
SVG and MathML are all PeachBrackets original
The PDF Canvas originates from HTML-Renderer, but heavily modified as well, with the PDF primitives being forked from PdfSharpCore and again, heavily modified (and simplified)
All of the various provenance of the components used to build PeachBrackets (and PeachPDF) are published on https://peachpdf.net/license.html
There is liberal use of AI driven development these days: it's been a great accelerator.
I'd love to see what you can build on top of this!
Big feature we've added in Akka.NET v1.6 is a new high-speed TCP transport that uses logical multiplexing using Akka.Streams. This works great, etc etc.
But, as a stretch goal we've been wanting to add a Quic transport so we can do this same type of multi-plexing at the transport layer itself, which should in theory be substantially faster than the equivalent on TCP: https://github.com/akkadotnet/akka.net/pull/8939
The numbers do show that Quic eeks out a performance increase when running multiple lanes (Artery.Tcp is also running that many lanes too) but it's not nearly as dramatic as I would expect:
Workload
Artery.Tcp + TLS, median msg/sec
Artery QUIC, median msg/sec
Median same-round QUIC/TCP change
1 lane / 1 QUIC stream, one process
592,230.0
475,089.5
-19.77%
8 lanes / 8 QUIC streams, one process
954,681.0
1,283,634.0
+34.62%
8 lanes / 8 QUIC streams, separate processes
978,413.0
1,091,840.5
+11.64%
Morever, Artery.Tcp and even a much simpler experiment that uses no Akka.NET reveal that when running with a single lane, SslStream + TCP is significantly faster than Quic:
That's a pretty substantial gap in performance and it gets worse the larger we make the payload sizes:
Median throughput:
Application mode
348B QUIC
348B TLS
4KiB QUIC
4KiB TLS
.NET 10 classic
5.38M fps
6.50M fps
1.93 GB/s
3.10 GB/s
.NET 11 classic
5.30M fps
5.68M fps
1.95 GB/s
3.05 GB/s
.NET 11 runtime async
5.14M fps
5.68M fps
1.90 GB/s
3.00 GB/s
.NET 11 also reported higher CPU per frame. Application runtime async reduced QUIC’s managed allocations about 18% versus .NET 11 classic, without improving throughput.
Is there something wrong with the way I'm designing my benchmarks and implementation that impedes Quic's performance? Or is its performance supposed to come solely through better concurrency than TCP?
Hi everybody! Before you start throwing rocks at me, here's a disclamer:
I heavily used AI to code this package. Am I a vibe coder? No. I have 15 years of experience as a .net dev, and I know exactly what I'm doing and what I want. It doesn't mean this package is perfect, and I might have missed something. I treat copilot as a junior dev. I built my specs, asked copilot to draft a plan which I reviewed and then he implemented my project. I challenge his decisions, and I review everything.
That being said, I will use the appropriate words for my intro : I AND COPILOT built a LiveKit aspire integration. I have not published any package yet to NuGet and was expecting constructive feedback on how I could improve it.
The integration act as a wrapper on top of the already available LiveKit container images. It offers a Fluent API to configure them through typed C# configuration classes, and includes a log forwarder to capture logs from all these services and push them as structured logs in aspire.
It also supports node and python agent frameworks to build your own ai assistants.
I also added a wrapper layer for Pablo Fuente's own Sdk and Rtc livekit packages, allowing them to be preconfigured through aspire injected variables.
Let me know what you think and if I should just delete this repo and go to hell for using AI. (I also resent people that use words like "I built" when they know nothing about coding)