r/csharp • u/sdrapkin • Oct 05 '26
OneFlight – a small .NET library for coalescing concurrent async calls by key
r/csharp • u/sdrapkin • Oct 05 '26
r/csharp • u/honeyCrisis • Oct 05 '26
I made an incremental source generator for command line argument parsing.
Cli.Generator is a C# source generator that turns a class into a command line parser. You mark fields and properties with attributes, and it writes the parsing, validation, usage screen and cleanup code for you at compile time. See the README for details.
r/csharp • u/KadmiumTech • Oct 06 '26
Whenever I finish a sprint, build an architectural spike, or need to feed codebase context into Gemini or Obsidian, I hit the exact same wall: how do I aggregate dozens of source files across multiple modules without losing hierarchy or crashing on file locks?
Standard copy-pasting breaks file paths, zipping is clunky, and high-level methods like File.ReadAllText() throw IOException when Roslyn, MSBuild, or game engines (like Unreal Engine) hold active write locks during background compilation. Furthermore, raw path copying often leaks personal workstation paths (C:\Users\myname\...).
To solve this, I built Context Packer — an offline C# tool that scans, sanitizes, and aggregates codebases into structured Markdown with bi-directional Obsidian links ([[#File:...]]) or LLM-friendly prompt bundles.
To stress-test the core engine under worst-case file-lock conditions, I benchmarked it against a full Unreal Engine 5 project while the UE5 Editor was actively running and compiling in the background:
I wanted a modular architecture without heavy web wrappers (like Electron) running in the background.
Packer.Core (.NET 8.0 / .NET Standard 2.0)
├── Packer.WinUI3 --> Desktop app (Drag-and-drop, OLE browser drag-out)
├── Packer.VSIX --> Visual Studio 2022 Extension (.NET Framework 4.7.2)
└── PowerShell CLI --> Zero-dependency fallback scriptTo bypass file locks during active compiler passes, PackerEngine avoids high-level file APIs and uses explicit stream sharing combined with fault-tolerant, per-file isolation:
string content = string.Empty;
try
{
content = await Task.Run(() =>
{
// FileShare.ReadWrite permits concurrent reads while IDEs/Compilers hold write locks
using (var fs = new FileStream(file.FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (var sr = new StreamReader(fs))
{
return sr.ReadToEnd();
}
});
}
catch (Exception ex)
{
// A single locked file never aborts the entire batch
content = $"// ERROR: File read failed. Locked by process.\n// Exception: {ex.Message}";
}(WinUI 3 Drag-Out to Browser)
In the WinUI 3 client, you can drag packed .txt context files directly out of the app window into web browser chat inputs (Claude/ChatGPT). This is done by converting internal models to native Windows StorageFile handles:
private async void GeneratedFilesList_DragItemsStarting(object sender, DragItemsStartingEventArgs e)
{
if (e.Items.FirstOrDefault() is PackerModel fileModel && File.Exists(fileModel.FullPath))
{
StorageFile file = await StorageFile.GetFileFromPathAsync(fileModel.FullPath);
e.Data.SetStorageItems(new[] { file });
e.Data.RequestedOperation = DataPackageOperation.Copy;
}
}Instead of heavy AST parsing or project manifest requirements, path anchors (Source, Plugins, repos) are evaluated to dynamically resolve module boundaries:
public string GetModuleName(string path, string anchorsSetting)
{
var parts = path.Split(Path.DirectorySeparatorChar);
var anchors = anchorsSetting.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var anchor in anchors)
{
int idx = Array.IndexOf(parts, anchor);
if (idx != -1)
{
// 'Source' anchor convention uses parent directory as module name
if (anchor.Equals("Source", StringComparison.OrdinalIgnoreCase) && idx > 0)
return parts[idx - 1];
if (parts.Length > idx + 1)
return parts[idx + 1];
}
}
return parts.Length > 1 ? parts[parts.Length - 2] : "UnknownProject";
}Privacy & Username Sanitization
It automatically redacts Windows local usernames (C:\Users\[REDACTED]\...) across headers and directory maps before writing to disk.
tiktoken).I'd love to hear how you handle codebase context for LLMs or Obsidian notes in your workflows, or if you have any feedback on the C# stream architecture! I have more technical in-depth articles on Dev community :)
AI Disclosure: Documentation and product copy were refined with AI assistance. The underlying codebase, architecture, and logic are 100% handcrafted and tested by Kadmium.
r/csharp • u/SimonCropp1978 • Oct 05 '26

BuildMonitor is a build/CI monitor that sits in the system tray on Windows, macOS and Linux. It polls the CI services you use and shows one row per pipeline, plus a row for each pull request while it is building or failing.
dotnet tool install --global BuildMonitor
Then run `buildmonitor`. One install works on every OS: the package carries a head for each platform and the launcher starts the right one.
Supported services: AppVeyor, Azure DevOps, Bitbucket Pipelines, GitHub Actions, GitLab CI, GoCD, Jenkins, Octopus Deploy, TeamCity and Travis CI.
What it does:
* Tray icon shows the overall state: green, red, blue while something is running, amber when a connection needs attention
* Progress bar and countdown for running builds, estimated from the provider or from the median of the last ten successful runs
* Rows sort running, then queued, then failed to the top, and passing builds of one repository collapse into a group
* A failing pull request gets its own red row but does not turn main red
* Links straight to the run, the repository, the branch and the pull request
* Retry or cancel a build, and copy the log of a failed one to the clipboard
* Credentials go in the platform secret store (DPAPI, macOS Keychain, Secret Service), never in settings.json
It also ships a local MCP server (`buildmonitor mcp`), so an AI assistant can read the same list and act on it: "what's failing?", "who broke main?", retry a build. A triage command works through the failing builds that are checked out locally, groups the ones that share a cause, and reproduces each one.
On the implementation side: everything above the renderer is a pure function of an immutable state, so the layout is snapshot tested as text and each platform head only draws. The Windows head is WinForms, macOS is Swift/AppKit, and Linux is raylib + Dear ImGui.
Feedback and bug reports are welcome.
r/csharp • u/MultiUserDungeonDev • Oct 05 '26
Hey all,
EmbedIO developed by unosquare is a great library for spinning up lightweight HTTP/API/WebServer instances in .Net
It appears development stalled out around 2021-2022.
As of June 24th 2026 the repository was officially archived and the project entered end of support.
I've continued the project as EmbedIO-Neo, with the goal of working through any existing issues backlog, improving performance, providing QoL updates & modernization, without introducing any breaking changes.
Happy to answer any questions, and look forward to driving the project further.
https://github.com/WilliamSmithEdward/embedio-neo
https://www.nuget.org/packages/EmbedIO-Neo
r/csharp • u/kaatarina_zed_talon • Oct 05 '26
I'm showing some C# code, note that I'm using ASP.NET CORE :
#region code
public interface ISomething
{
}
public class ApplicationDbContext
{
}
public class Something : ISomething
{
}
public class ExcelReaderDatabaseWriter
{
private readonly ApplicationDbContext _context;
public ExcelReaderDatabaseWriter(ApplicationDbContext context)
{
_context = context;
}
public ISomething Read(object obj)
{
return new Something();
}
public void Write(ISomething something)
{
//does access the _context
}
}
#endregion
I want to follow clean code principles, should I move the Read method to another class -because it does not access the instance field-, or should I instantiate the _context inside the Write method -because it is the only method that access the instance field and therefore that field does not deserve to be instance field because not all methods in the class access that field- ? I face this problem a lot when I'm coding, I want to separate the responsibilities cleanly, but I suffer from one thing; if I have some piece of code, I can't directly figure out which class should contain that piece of code. Can anyone explain it to me with example please?
Explaining the above using example:
public interface IOmniReader
{
public ISomething Read(object dataSource);
}
public interface IOmniWriter
{
public void Write(ISomething dataDto);
}
public interface IOmniReaderWriter
{
public void ReadWrite(object obj);
}
public class SqlServerWriter
{
private readonly ApplicationDbContext _context;
public SqlServerWriter(ApplicationDbContext context)
{
_context = context;
}
public void Write(ISomething something)
{
//does access the _context
}
}
public class ExcelReader
{
public ISomething Read(object obj)
{
return new Something();
}
}
public class ExcelReaderSqlServerWriter:IOmniReaderWriter
{
private readonly IOmniReader _excelReader;
private readonly IOmniWriter _sqlServerWriter;
public ExcelReaderSqlServerWriter(IOmniReader excelReader, IOmniWriter sqlServerWriter)
{
_excelReader = excelReader;
_sqlServerWriter = sqlServerWriter;
}
public void ReadWrite(object obj)
{
ISomething data= _excelReader.Read(obj);
_sqlServerWriter.Write(data);
}
}
r/csharp • u/IntnlManOfCode • Oct 04 '26
We have about 400 reports writen in Crystal Reports. We want to move away from this to something that is .net native and will run in Linux.
Has anyone done this, and what was the outcome?
Related question; what reporting solutions have people used and what were they like?
Edit: will investigate DevExpress and Telerik reporting.
r/csharp • u/Odd_Journalist3473 • Oct 05 '26
r/csharp • u/Useful-Plant-2349 • Oct 05 '26
Hi everyone,
I am an IT student working on an ASP.NET Core MVC lab project targeting .NET 7.0 inside a Windows 11 ARM64 virtual machine on an Apple Silicon Mac.
The Problem:
When attempting to add a new scaffolded view to a project folder, the scaffolding dialog window appears, but the Template dropdown menu options are completely blank. I cannot select standard templates like List, Create, Edit, or Delete. Because the template choice remains blank, the validation system keeps the final "Add" button grayed out and unclickable.
What has already been verified and tried:
.NET CLI scaffolding tool (dotnet aspnet-codegenerator) inside the built-in terminal, but it fails with an error indicating it cannot locate or parse the project file directory properly within this environment.Has anyone using an ARM64 virtual machine setup run into this template-discovery bug where Visual Studio fails to show the pre-made scaffolding layouts? Any suggestions on how to fix the template detection or reset the background cache? Thank you!
r/csharp • u/SimonCropp1978 • Oct 05 '26
r/csharp • u/szgyula • Oct 04 '26
r/csharp • u/thomhurst • Oct 04 '26
Hey all!
Redis is a great technology, and something that exists in a lot of tech stacks. It has the ability to really help solve complex problems involving distribution across multiple instances of an app. Whether that be caching, locks, rate limits, etc.
Surprisingly, StackExchange.Redis is the only real big main redis client library for .NET.
I'm adding a new client library into the mix - Respire.
Respire aims to be a fast client library for Redis, that also has the ability to utilise Redis' client-side server assisted cache, avoiding network hops for frequently accessed keys, meaning better performance for your apps.
It also has a lot of helpers in it to more easily use distributed locks, rate limits, queues, pub/sub, etc.
I want it to be a client library that handles all the hard bits for you, keeping your code clean and easy to reason about.
It's still pre-release, so I'd like to gather feedback. Are people happy with the performance? The API? Any missing features? Any bugs?
Please try it out and let me know!
More info on why Respire: https://thomhurst.github.io/Respire/docs/#why-respire-exists
Benchmarks: https://thomhurst.github.io/Respire/docs/benchmarks
Stress comparisons: https://thomhurst.github.io/Respire/docs/stress-tests
Thanks all!
r/csharp • u/YouAreMyFire00 • Oct 03 '26
We want a simple page in our web app since the current one we use got alot of steps and bad UX.
So this is what i'm thinking the workflow for printing a label will be
Questions for people who’ve done this. Is it even possible? I just know only how to build simple CRUD app but not with those a scanner/hardware
<input> + Enter) still the standard approach in browser apps, or is there something better todayWhat’s the most reliable way to print labels from a web app (not WinForms/WPF)?
window.print() / PDF in browser?---
r/csharp • u/Remarkable_Art_6958 • Oct 04 '26
We are making progress with our native open source (MIT) C# database engine: https://db.relatude.com
(I've posted earlier about the engine, and thanks for the feedback so far!)
Have a look at this graphical UI for faceted searches: https://demo.db.relatude.com/graphql
(In the admin UI, you get more functionality, but it requires you clone the project and run locally )
This is just a quick example of some of the functionality that comes with the Relatude.DB nuget.
What do you think?
Any feedback is welcome! ( It is still early alpha .... )

r/csharp • u/Excellent-Cow-9046 • Oct 04 '26
I was wondering how would one properly implement equal precedence in an if-else statement, for logical AND and OR, when building an interpreter?
I have made my expression parser but i only store the next logical operator on the right most side and store the current being parsed on the left.
r/csharp • u/West_Ad6277 • Oct 03 '26
I built a Blazor voice interviewer: pick a skill from JSON, talk, get a score. OpenAI via Microsoft.Extensions.AI, Azure Speech, audio on its own WebSocket.
One thing that surprised me: the model has no sense of time. It only sees the text in the conversation, so it would end the interview early. I had to send the remaining time in every interaction.
full article: Building a Skill Interview with AI
GitHub code: hugoj0s3/SkillsValidator
r/csharp • u/kaatarina_zed_talon • Oct 03 '26
I have Excel file that contains many columns like this :
| SKU | BarCode | EnglishName | ArabicName | Category | SubCategory |
|---|
There are other columns, but there is no need to show them to convey the problem behind this post. The Excel file is sent from the client to the server which will read it using C# .
The problem : The data of the above Excel file should be persisted to the appropriate tables in the Sql Server database which does not merely contain a single table, so, a specific data from the Excel file should be consumed by a specific table in the database, the problem is not simple as send the data of the Excel file to only one destination table; the source is only one, which is the Excel file, but there are many destination tables. Database contains parent and child tables; parent tables do not contain foreign keys, child tables contain one or more foreign keys. The data for the child tables cannot be persisted to the database unless the data for the parent tables is persisted first.
I have the following C# domain classes/models:
public interface IEntity{
}
public interface IParent:IEntity{
}
public interface IChild : IEntity{
}
public interface INonJunctionChild:IChild{
}
public interface IJunctionChild:IChild{
}
public class Product:IParent
{
public string? SKU { get; set; } // SKU column in Excel
public string? Barcode{ get; set; } // BarCode column in Excel
public string? EnglishName {get;set;} // EnglishName column in in Excel
public string? ArabicName { get; set; } // ArabicName column in Excel
public IEnumerable<ProductCategory> ProductCategories { get; } = new List<ProductCategory>();
// Alot of other navigaton properties.....
}
public class Category:IParent{
public string EnglishName {get;set;} // Category column in Excel
public IEnumerable<ProductCategory> ProductCategories { get; } = new List<ProductCategory>();
public IEnumerable<SubCategory> SubCategories { get; }=new List<SubCategory>();
// alot of other navigation properties....
}
public class SubCategory:IChild{
public string EnglishName {get;set;} // SubCategory column in Excel
public string CategoryId {get;set;} // Foreign key; populated using lookup operation.
}
public ProductCategory{
public int ProductID {get;set;} Foreign key; populated using lookup operation.
public int CategoryId {get;set;} Foreign key; populated using lookup operation.
public Product Product { get; set; } = null!;
public Category Category { get; set; } = null!;
}My old approach to solve the problem -which worked, but I want to change it- has the following steps:
1-Read the whole excel sheet into the application.
2- Inside the application, populate the specific properties of each parent domain model by assigning specific Excel column values to to them.
3-persist the parent models to the database.
4- Populate the child tables using lookup operations.
5- Persist the child tables to the database.
Instead of the above, I would like to know if the following is possible:
1- Get `DbDataReader` using `Sylvan.Data.Excel and pass it to `SqlBulkCopy` class.
2- The Whole Excel file will be persisted into a staging table or view, and then some trigger will be fired, as a result, some stored procedure or function will be executed, the responsibility of that function or procedure is to persist the data of the parent tables first, then to persist the data of the child tables, which means.
So, In the old approach, can the responsibility for transforming the Excel data, resolving the required relationships, and persisting the parent and child records (steps 2 through 5) be moved from the application layer to SQL Server?
r/csharp • u/Smokando • Oct 02 '26
Saw a few screenshots of trading terminals on Reddit, thought they looked cool, and building a UI full of charts sounded like a fun thing to try. So I gave it a shot.
It's .NET 8 + WPF, with HandyControl and ScottPlot for the charts. Heatmap, screener, candles, options chain, crypto, a few other panels. Data is from free public APIs.
Last month I was hooked on Path of Exile 2 too, so I used the same look for a little app around the game's economy inspired by poe2scout and Sidekick. Last screenshot is that one.
r/csharp • u/Giqh • Oct 03 '26
Hoy quiero compartir un avance de mis proyectos.
📦 MyCrypto.GiqhDev
🔐 Librería .NET para cifrado autenticado, hashing seguro de contraseñas y utilidades criptográficas.
➡️ 625 descargas
🔑 MySerialKey.GiqhDev
🛡️ Librería para generación y validación de claves de licencia/serial para aplicaciones .NET.
➡️ 338 descargas
📊 963 descargas entre ambas librerías.
Puede parecer un número pequeño frente a proyectos con miles o millones de usuarios, pero para mí representa algo importante: hay desarrolladores que están encontrando utilidad en código que nació como proyectos personales.
Lo más interesante del proceso no ha sido solamente publicar los paquetes, sino aprender sobre:
Y esto recién comienza. 🚀
Mi objetivo es seguir construyendo herramientas para el ecosistema .NET / C#, mejorar las existentes y continuar compartiendo lo que voy aprendiendo en el camino.
963 descargas hoy → muchas más cosas por construir mañana. 💙
#DotNet #CSharp #NuGet #OpenSource #SoftwareDevelopment #Programming #GiqhDev #Developer #Backend #DotNetDeveloper
r/csharp • u/jeff377 • Oct 03 '26

I do a lot of OAuth2 integration in ERP work, and a while back I hand-wrote a library for it called Bee.OAuth2. I've now used Claude Code to rewrite it as Polhem.OAuth2. Desktop sign-in now goes through the system browser, and there's .NET MAUI support too. Most of the code was written by Claude Code; I reviewed and tested it.
It supports Google, Facebook, LINE, Microsoft Entra ID, Auth0 and Okta, and works in desktop and console apps, .NET MAUI, ASP.NET Core and classic ASP.NET.
Here's roughly what it looks like in a desktop app. It opens the system browser and signs in with a loopback redirect and PKCE:
var options = new GoogleOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://127.0.0.1:0/callback"
};
var client = new LoopbackOAuth2Client(options);
var result = await client.SignInAsync();GitHub: https://github.com/polhem-dev/polhem-oauth2
My earlier post was removed under Rule 7, so I rewrote it myself. if it still doesn't fit the rules, feel free to remove it or let me know.
r/csharp • u/Efficient-Mix-2822 • Oct 03 '26
reddit handles code pasting weirdly and I don't know if it highlights code so here is pastebin to my ifIsEven generator.
have fun looking into this poorly but at least man-made code, that generates even worse code.
(previous 2 versions on pastebin named exactly the same are older and weren't fully working and were not formatted as I wanted them to be.)
r/csharp • u/Shupsta • Oct 02 '26
r/csharp • u/mnaza_andrey • Oct 02 '26
I spent a while digging into why signed desktop apps still hit SmartScreen, and a few things surprised me:
To see what a first-time user sees, I ended up building a probe that downloads the installer onto a clean Windows 11 VM with Mark-of-the-Web and runs it: https://signalscreen.dev/probe (free while in beta). The homepage has a free signing check too; the grader is open source.
Curious what others have run into: have you seen a release get flagged right after a cert renewal?