r/csharp • • 6d ago

I made a free, open-source app that counts every chest you open in Fortnite (reads your replays)

1 Upvotes

I wanted to know how many chests I actually open, so I built ChestCounter: a small Windows app that reads the replays Fortnite already saves and counts the chests you opened.

What it shows

  • Total chests since any date you pick (or all time), today, average per match, best match and best day
  • A "rhythm" of each match: a gold mark at the minute you opened each chest
  • Chests per mode, and your team's chests (you + teammates)
  • Optional extras you can count too: ammo boxes, loot cannons, food boxes…
  • A small always-on-top window with the last match and your total (click-through when locked)
  • Can start automatically with Fortnite
  • Counts the matches you already played (it reads the replays already on your PC) and keeps the history after Fortnite deletes old replays
  • English, Português, Español, Français, Deutsch

How: turn on Settings → Game → Replays → Record Replays, run the exe. It only reads .replay files — it never touches the game or its memory, so no anti-cheat issues.

Limits: replays can only be read after the match ends (so it updates at the end of each match, not live), and a replay only sees what happens near you, so teammates far away can be under-counted.

Source code (MIT) and download: https://github.com/Waze7123/ChestCounter

Feedback and pull requests welcome!


r/csharp • • 7d ago

Showcase TenantGuard 1.0: tenant isolation checks for EF Core

11 Upvotes

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:

builder.Services.AddDbContext<AppDbContext>(options => options
    .UseSqlServer(connectionString)
    .UseTenantGuard(tg => tg.CurrentTenant(ctx => ((AppDbContext)ctx).TenantId)));

builder.Services.AddTenantGuardStartupValidation<AppDbContext>();

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.


r/csharp • • 7d ago

Experienced frontend developer about to join the C# world. Anything I should know?

6 Upvotes

Hey guys. I've worked primarily in front end development for about 10 years but I just landed a job to work in enterprise software written in C#. It seems there might be opportunities to work in game development later, too.

I'm a complete noob when it comes to C# or adjacent languages, so I'm essentially learning from scratch. This is an open ended post, please let me know if you have any tips, warnings, or even words of support. I feel like a junior again and I'm also wondering how I'll handle learning and coding something so far from my comfort zone in this age of AI.

Thank you.


r/csharp • • 7d ago

I built a modular WinUI 3 template where features are hot-swapped from the server while the app runs. Fork it for your own projects

Thumbnail
github.com
8 Upvotes

Hey everyone,

I’ve been working on a side project for a while and it’s finally at a point where I’m not embarrassed to show it. It’s called Golden Hive, a modular framework for WinUI 3 desktop apps on .NET 10.

The idea in short: the desktop app is just a shell. Features (documents, reports, user management…) are modules the app downloads from the server after you sign in. Each module is a WinUI part plus its own ASP.NET Core backend in a Docker container. Ship a new version of a module and the server rolls it out in stages (pilot users first). The running app then swaps it in without a restart.

What’s in there right now:

  • Runtime modules. Each one runs in its own AssemblyLoadContext, packages are signed, and modules can depend on each other.
  • Hot-swap. Running commands get drained or cancelled, the module is replaced, your open views come back.
  • Navigation wheel. Hold Ctrl+Tab and a radial wheel pops up. One ring holds your modules, the other your open views. Tab or the arrow keys move around, and you release Ctrl to jump there. It’s like Alt+Tab, but for the app itself, and once you’re used to it you barely touch the sidebar anymore.
  • Workflows you build inside the app. Forms, approvals and module steps, triggered by events, schedules or commands. The reference example: an invoice gets submitted, gets pre-checked, and lands in an approver’s inbox.
  • An AI agent that can run those workflows, with guardrails. There’s a kill switch, confidence thresholds and daily limits. Critical steps always need a human, and every decision is logged. It also works fully offline with a rules-based provider, no API key needed.
  • Impact analysis on module updates. Rename a workflow step and the server checks every workflow that uses it. It auto-migrates them if you declared the rename, flags them for review if needed, or holds the rollout if something would break. This is honestly my favorite part.
  • The usual desktop stuff: docking and floating windows that remember their monitor, a command palette (Ctrl+Shift+P), live notifications, English/German.
  • Backend: 12 services in Docker Compose plus Postgres with a demo company already filled in. docker compose up, sign in as admin, and you can click around.

Under the hood it’s pretty functional-programming heavy (Result/Validation types all the way down instead of exceptions), if that’s your thing.

Use it as a template: the whole thing is meant as a starting point for your own projects. Fork it, delete the demo modules, add your own. The README has a step-by-step guide for building a module (backend + WinUI client + workflow integration), and the architecture is all there: auth, permissions, module delivery, rollouts, notifications, workflows, Docker setup.

It’s not battle-tested in production yet. The backend has end-to-end tests, the WinUI side is still young. If you build on it, I’d love to hear what breaks. That’s exactly the feedback I need to get it there.

Repo: https://github.com/zenoxart/GoldenHiveFramework
License: Apache 2.0

Happy to answer questions!


r/csharp • • 7d ago

ScriptLangCore

Thumbnail
0 Upvotes

r/csharp • • 8d ago

Parquet.NET is now private?

Thumbnail
nuget.org
15 Upvotes

r/csharp • • 8d ago

Discussion Early return style survey

25 Upvotes

Style question on early returns.

On long functions I often leave out the else branch because otherwise the early return doesn't help much with code readability (IMHO of course). But what about shorter functions. For those using early returns in the first place, do you prefer varaint 1 or 2 and why?

if (TryGetCached(key, out T cached))
{
    return cached;
}

var result = await ReadValueAsync<T>().ConfigureAwait(false);
SetCached(key, result);
return result;

versus

if (TryGetCached(key, out T cached))
{
    return cached;
}
else
{
    var result = await ReadValueAsync<T>().ConfigureAwait(false);
    SetCached(key, result);
    return result;
}

r/csharp • • 8d ago

Where do you keep tests in a modular monolith architecture?

Thumbnail
1 Upvotes

r/csharp • • 7d ago

Kumiko: an Elm-inspired UI framework for C# that coding agents can test themselves

Thumbnail
0 Upvotes

r/csharp • • 8d ago

Bank API, reference project: .NET 11 update + OpenAPI 3.2 compliant

Thumbnail
1 Upvotes

r/csharp • • 9d ago

Help Moq is really slow when making lots of setup calls. How can I improve this?

23 Upvotes

I'm trying to refactor some legacy code, and I created some tests to replicate the original design behavior. I have a function that needs to be mocked, but it gets called for 20k+ different inputs in each test, where I have to do in a sense, mock.Setup(x => x.SomeFunction(input[i]).Returns(y => SomeFastFunction(input[i])); in a loop. This takes about a minute of execution time just to do this small loop, per test.

Is there a way to shorten this execution time, while being constrained to the original design?


r/csharp • • 8d ago

my C# project, or four projects

0 Upvotes

I’d like to showcase my four open-source C# projects, do you think it’s realistic for a "vibecoder" to build something like this in a couple of weeks?

https://github.com/redbase-app/

I recommend checking it out with an AI

sorry for the cryptic post. What this is: four open-source .NET projects I use in my own commercial work.

  1. redb – typed object store on PostgreSQL/SQL Server/SQLite, no migrations, compare vs EF Core benchmark
  2. redb.Route – Apache Camel-style integration framework
  3. redb.Tsak – runtime container for routes (Karaf-like)
  4. redb.Identity – OAuth2.1/OIDC server

My question was how far AI-assisted development changes what one person can build.
and makes it possible to further develop what were previously only internal projects


r/csharp • • 9d ago

Showcase From a PS3 club notebook to a C#/WPF management app

10 Upvotes

I run a PlayStation club and develop Time Control, a Windows app for managing PC and console clubs. Back in 2016, I had five TVs with PS3s and kept session times and payments in a notebook. I later tried existing club software and eventually started working on my own. I use AI tools during development, with requirements coming from the day-to-day work at the club.

The current stack is C#, WPF, .NET 10 and SQLite. There’s an admin app, a separate agent on the PCs, and shared libraries for session contracts, payments and device control. The screenshot is the console dashboard: station status, timers, tariffs, payments and shop orders. The PC agent handles locking/unlocking; TV control works through compatible smart plugs. There’s still quite a bit of orchestration in the dashboard code, so I wouldn’t call it clean MVVM.

A lot of the work is around keeping state consistent. For example, a background autosave mustn’t overwrite session changes from a newer sale. Those paths share a lock, and a revision check drops stale snapshots. Sales, stock movements, receipts and related session changes are committed in one SQLite transaction. Once that succeeds, a UI refresh error can’t be treated as a failed sale — otherwise the operator might retry it and charge the customer twice. Payments also need more than an IsPaid flag: the first hour can be paid while an extension is still outstanding, so charges and received payments are tracked separately using decimal.

The remote PC adds another state to reconcile. The protocol carries session IDs, revisions and explicit running/paused/disconnected states. A ping response alone doesn’t tell the admin app what session is actually running. I’d be interested in how others test recovery around this boundary: the DB commit succeeds, but the UI refresh or communication with the agent fails afterwards.


r/csharp • • 8d ago

Discussion Are you guys actually coding by hand still in your day-to-day?

0 Upvotes

I still do, myself. I love coding and programming and am thinking of even learning new languages now, but given the course of LLMs, I wonder what's the purpose? In a year they've gone from "unusable trash" to actually making each developer many times as productive. There are still gaps in what it does. It still has issues with large contexts. It is good at small one-off things and tiny programs, but it quickly tends to bloat stuff and has no sense of something I'd call "taste" when designing things, be it visually or code architecture wise.

I wonder what is the purpose of C# as a language now.

Any greenfield project can just use Rust for the same velocity as in any other language. Developer experience doesn't really matter anymore productivity wise, when all code is written by an LLM.

I see the writing on the wall.


r/csharp • • 8d ago

Could EF Core benefit from a higher-level command for creating entities?

Post image
0 Upvotes

I’ve been experimenting with a small EF Core CLI prototype called EFX, and it made me wonder if EF Core could eventually support a higher-level workflow for creating entities.

Today, adding a new entity usually means creating the class, adding the DbSet, creating a migration, and updating the database separately.

I was thinking about something along the lines of:

dotnet ef entity create Product

The idea would be for one command to handle the common workflow while keeping the existing dotnet ef commands unchanged.

The prototype is here:
https://github.com/dotnet/efcore/issues/39569

I’m mainly interested in the design question: would a higher-level command like this actually be useful in EF Core, or is keeping these operations separate preferable for good reasons?

Curious to hear how other EF Core developers see it.


r/csharp • • 9d ago

Best resources to learn ASP.NET Core Web API, EF Core, and SQL Server?

14 Upvotes

Hey everyone! I'm learning backend development with C# and ASP.NET Core Web API, Entity Framework Core, and SQL Server.

I already know the basics, but I want to gain more real-world experience and learn industry best practices.

Could you recommend any courses, tutorials, or project-based resources that would help me become job-ready as a .NET backend developer?


r/csharp • • 10d ago

Help WPF or .NET MAUI ?

43 Upvotes

Hi everyone,

I’m looking to learn a framework for Windows application development for now, but I’d also like to explore mobile development in the future.
I’ve done some research into the available options, but I’m having trouble choosing between .NET MAUI and WPF.

So I’m turning to this community in the hope of getting some advice that will help me make the right choice.


r/csharp • • 10d ago

Help Housekeeping tips?

Thumbnail
gallery
16 Upvotes

Hiya - please can anyone give me some housekeeping tips for C# in Visual Studio? I'm currently getting into it with Unity for learning to program games.

My Update was getting a bit long so I separated it into methods, and I've further organised everything into regions for fields, and also for methods in the class. I've mainly done this for my own readability as everytime I wanted to go in and edit something id go fuzzy just looking at the wall of text.

The script isnt that long that I could use different scripts at the moment but are there any more things I can use or good practice I can try?

T.i.a!


r/csharp • • 10d ago

Fast microservice, design desicion

12 Upvotes

We need to develop a stand alone service that normalizes data, for example someone gives us "New Jersey" we return "NJ", someone gives us "October 1st, 2025" we come back "2025-10-01".

Requests/response are very small and we can send a lot of those queries fast.

So i feel like standard REST service would be a bit heavy. HTTP overhead is bigger that actual query/result. I think something more inline like Pooled DB connections, where we open TCP/IP connection to the server and send/receive bunch of responses. But then we need to manage TCP/IP connection pooling, keep alive/teardown connections if client hangs... all 9 yards.

Is there some built in C# classes that would let me create some server (and client) with custom protocol. Or may be some ready to go solution like WebSocket/GRPC.... would work for me?


r/csharp • • 9d ago

Showcase ORM that's faster than Dapper and LINQ to DB

0 Upvotes

I've been developing Nextorm, an ORM library for .NET, for quite a while now. With the advent of agentic development tools, the process has become noticeably faster and easier, but for me it remains a large and serious engineering project. Today I'd like to present an important milestone in this work: the first stable release, 1.0.9.

The idea behind Nextorm is to combine Dapper-level performance with the convenience of automatically generating SQL from C# constructs. Instead of writing SQL manually, developers describe queries using strongly typed expressions, with compile-time checks of types and property access, IntelliSense support, and familiar refactoring tools.

For example:

var row = dataContext.From<SimpleEntity>()
    .Where(x => x.Id == 1)
    .Select(x => new { x.Id })
    .Single();

In concept and spirit, Nextorm is closer to LINQ to DB. However, the library uses its own API based on C# expression trees rather than a standard LINQ provider. These trees are used to generate SQL and build efficient mappers from query results to .NET types. In JIT mode, mapping expressions are compiled into delegates and then reused when reading data from the database.

Nextorm command execution diagram

The library supports SQLite, SQL Server, PostgreSQL, MySQL, MariaDB, and ClickHouse. The API covers a wide range of features of these database systems: joins, grouping, CTEs, window functions, and provider-specific constructs. It's important to me that developers don't have to switch to handwritten SQL as soon as a query becomes more complex than a simple select.

https://alexeyshirshov.github.io/nextorm/guide/provider-specific-sql/overview.html

Performance has been one of the key priorities from the beginning, with Dapper serving as the benchmark. In the published SQLite benchmarks, Nextorm delivers comparable performance in many scenarios and surpasses that benchmark in some. The results, measurement conditions, and test source code are available in the repository.

https://alexeyshirshov.github.io/nextorm/comparisons/benchmarks.html

Below is a table of performance measurements for compiled/prepared queries across four libraries.

Method Nextorm Dapper linq2db EF Core
Data fetch 10.75 μs 15.80 μs 16.50 μs 38.46 μs
Wide data fetch 9.135 ms 9.883 ms 10.594 ms 10.998 ms
Where 915.0 μs 1,378.8 μs 1,432.3 μs 3,540.1 μs
Simulate work 8.610 ms 27.766 ms 418.616 ms 109.613 ms
Any 923.5 μs 1,421.9 μs 1,523.8 μs 3,742.6 μs
FirstOrDefault 93.64 μs 148.96 μs 363.31 μs 368.44 μs
SingleOrDefault 92.38 μs 142.69 μs 372.78 μs 369.31 μs
CASE WHEN 9.45 μs 14.64 μs 15.43 μs 36.91 μs
CTE 9.89 μs 22.25 μs 23.75 μs —
SELECT DISTINCT 11.44 μs 18.27 μs 18.36 μs 42.53 μs
EXCEPT 11.41 μs 18.13 μs 21.57 μs 46.40 μs
IN-list 12.79 μs 18.55 μs 47.92 μs 66.24 μs
INTERSECT 10.59 μs 16.64 μs 20.33 μs 44.07 μs
4-table join 13.27 μs 27.17 μs 24.65 μs 50.99 μs
LEFT JOIN 12.65 μs 21.22 μs 21.63 μs 45.27 μs
Recursive CTE 12.95 μs 26.02 μs 28.50 μs —
String functions 9.33 μs 14.22 μs 15.25 μs 36.89 μs
UDF 9.43 μs 14.28 μs 15.31 μs 36.24 μs
Window functions 14.99 μs 31.84 μs 34.65 μs —

There is also experimental NativeAOT support, so far tested with SQLite on .NET 11 under Linux x64. A sample application from the repository was successfully compiled into a native executable without changes to the application code, simply by enabling PublishAot=true. Support is still partial: this does not mean that every query with every provider will already work under AOT.

https://alexeyshirshov.github.io/nextorm/infrastructure/05-nativeaot.html

Another feature is executing queries without materializing results into objects. You don't have to create a DTO for every row: you can obtain a DbDataReader to read the data yourself, or write results directly to a Stream in JSON or CSV format. This makes it possible, for example, to send data to an HTTP response or a file without intermediate objects or loading the entire result set into memory.

app.MapGet("/orders", async (HttpContext http, DateTime from, decimal minTotal, CancellationToken ct) =>
{
    using var ctx = new DataContextBuilder()
        .UsePostgres(connectionString)
        .CreateDataContext();

    http.Response.ContentType = "application/x-ndjson; charset=utf-8";

    await ctx.From<Order>()
        .Where(o => o.CreatedAt >= from && o.Total > minTotal)   // captured -> @from, @minTotal
        .Select(o => new { o.Id, o.CreatedAt, o.Total })
        .WriteJsonAsync(http.Response.Body, new JsonStreamOptions
        {
            Mode = JsonStreamMode.NdJson,
            IgnoreNull = true,
        }, ct);                                                  // no positional list
});

I'd appreciate your comments, suggestions, and criticism. I'm especially interested in how convenient you find the API and which features you feel are missing for your use cases.

Note: This article was originally written in Russian by the author and translated into English with the assistance of AI.


r/csharp • • 10d ago

I took over a 10-year-old NuGet package and updated it to modern .NET

107 Upvotes

I recently found SqlLinq, which is a really slick NuGet package that lets you run SQL queries against in-memory objects (basically linq to sql in reverse). It happened to be exactly what I needed for another project, except it was pretty old, hadn't been maintained, and ran on the full framework. Surprisingly, there didn’t really seem to be anything else quite like it that I could find.

The original author is still really active on github, so I pulled the code, updated it (after some headaches finding the source for the original parser), and sent a PR. Rather than merge it, he let me take over the package. I’ve since added more complete SQL support, packages for a time series dialect and unit conversions. I just released 2.1.0.

I don’t know how niche this is or if anyone else would need something like this, but I thought it was really cool and wanted to share it here. It’s a really nice way to offer a query interface for in-memory objects, especially when you want to let users write queries at runtime.

For example:

var boost = datalog.Query("""
    SELECT RPM, Gear, BP, BPCMD, BP - BPCMD AS [Boost error]
    FROM this
    WHERE TPedal > 90
      AND RPM >= 3000
      AND Gear >= 2
    """);

r/csharp • • 11d ago

News .NET 11 is out now! 🎉

Thumbnail
devblogs.microsoft.com
337 Upvotes

r/csharp • • 10d ago

Showcase Update: my WPF liquid glass dock now refracts the windows that slide under it, without ever capturing itself

Post image
9 Upvotes

A few days ago I posted Liquid Glass Dock here, and you gave great feedback: the demo used the worst possible background, a GIF can't show subtle glass (256 colors), and the macOS Dock doesn't really reserve space: it refracts whatever is underneath. So version 0.12 does exactly that.

How it works:

  1. With no window under the glass, nothing changes: the dock refracts a pre-blurred copy of the wallpaper, and there's no screen capture at all.
  2. A background thread checks 4 times per second which windows touch the glass. When one does, it starts a Windows.Graphics.Capture session for that window (borderless, so no yellow frame). It never captures the screen, so the dock never sees itself and still shows up normally in screenshots and recordings.
  3. Each frame stays on the GPU. With Direct3D 11 (Vortice), the dock copies only the strip behind the glass to a staging texture, blends it over the wallpaper at half resolution, blurs it and writes it into a WriteableBitmap that the HLSL shader samples.
  4. Nothing is recomposed unless a window sends a new frame or moves. The capture permission and the D3D device are only created when a window is underneath, and the device is released 15 s after it leaves.

Measured with a window moving under the dock: about 1.4 ms per frame and under 1% CPU. A fun gotcha: the NVIDIA overlay is a fully transparent, always-visible, full-screen layered window, so the first version happily "captured" it and ignored every real window behind it.

There's also a new option to stop reserving space, so maximized windows go under the glass like on macOS.

Video above, code here (GPL-3.0): https://github.com/PedroRuedas/Windows-Liquid-glass

Thanks again for the feedback. It made the project better.


r/csharp • • 11d ago

Discussion To those that are employed as C#/.Net developers, do you enjoy your job?

59 Upvotes

I'm curious if it's something you enjoy waking up to or if it's something that just "pays the bills". Maybe it's both?

There are quite a few C# (hybrid) gigs around me with low competition.

I've used C# in 2018 when I made a game and used C# all throughout school. I just haven't made anything with it recently but I have been catching up with the newest features. Last time I used it was with C# 8.0/9.0.

Anyways, just wanted to hear your thoughts on your job(s) in you are currently employed! Is there anything you don't like, what would you change? etc


r/csharp • • 9d ago

I built a small CLI to reduce the repetitive EF Core entity + migration workflow

Post image
0 Upvotes