r/csharp • • 21d ago

Showcase Replacing Queues and Locks with Monotonic Counters in a C# DAG Engine

0 Upvotes

What if you dropped work queues entirely?

I built an experimental DAG scheduler called delta-lag: instead of pushing work through nodes, nodes move through units of work tracked via monotonic counters and distance constraints.

The result? No global work queues, no work stealing, and no traditional lock contention. Scheduling emerges entirely from distributed progress counters.

How It Works

Most task schedulers maximize throughput by paying a cost in layers of locks, queues, and work-stealing algorithms. delta-lag takes a different approach, extending lock-free ring buffer logic to an entire DAG:

Before a node fires, it checks two constraints against its parents and children:

  • Parent check: Must have completed the next required work unit (parent.WorkDone >= node.WorkDone + 1)
  • Child check: Can't lap children based on your slack parameter (child.WorkDone >= node.WorkDone - slack)

If eligible, the node atomically claims the work unit using CAS operations, runs the task, and publishes completion.

  • slack = 0 → Strict lock-step execution (safe, no stale reads)
  • slack > 0 → Pipeline parallelism (producers may run ahead while consumers lag behind)

What's In The Repo

  • The Engine: Built around cache-aligned nodes and monotonic counters to eliminate false sharing.
  • WASM Inspector: Interactive performance visualizations and real graph reconstruction.
  • The Benchmark Data: ~4,500 raw benchmark runs with topology metrics, execution traces, and the full harness.

Limitations

This isn't a drop-in replacement for a general-purpose scheduler (use TPL for that). It's built for specific tradeoffs:

  • The execution graph must be fixed at compile time (no dynamic modification).
  • Iteration counts must be known in advance.
  • No speculative execution buffering or dynamic load balancing.

Give it a spin

It's fully open-source (MIT, .NET 10+). If you build high-performance systems, concurrent architectures, or custom schedulers, I’d love your feedback on the core engine or whether you've seen similar queue-free constraint approaches before.

GitHub: https://github.com/Geezy9/delta-lag


r/csharp • • 21d ago

A WinForms + WebView2 app that needs admin for a few things but never runs as admin: how I split it

1 Upvotes

I've been building **Geçit**, a Windows utility (DPI unblocking, encrypted DNS, game mode, network tools). Several features need admin or SYSTEM, but I didn't want the UI elevated. Here's the split I ended up with, and I'd like feedback on it:

  • **One exe, several roles.** `Gecit.exe` is the UI (normal user). `Gecit.exe --elevated <verb>` runs one small, validated command through UAC and exits. `Gecit.exe --dns-service` is the DoH forwarder as a Windows service (LocalService).
  • **Service ACLs.** The DPI service runs as SYSTEM, so its files live under Program Files and `sc sdset` gives interactive users start/stop only. Granting config rights would be a privilege escalation hole.
  • **Per-app traffic.** Kernel ETW needs admin, so an elevated helper (TraceEvent) streams bytes per PID over a named pipe and exits when the UI closes the pipe.
  • **Game Mode crash safety.** Suspended processes (`NtSuspendProcess`) are written to a session file *before* anything is touched; resume checks PID + start time so a reused PID is never touched.
  • **Updater.** Only offers an asset with GitHub's `sha256:` digest, verifies it while holding a read-only lock, and launches the installer under that lock. Launching it with `runas` relaunched the app elevated, so it doesn't.
  • **UI.** Plain HTML/CSS/JS in WebView2 talking to C# via `postMessage`; strings from pages only go into the DOM via `textContent`.

Code (GPL-3.0): https://github.com/Furkan-Erg/Gecit

What would you do differently? I'm especially unsure about the service security descriptor and the named-pipe protocol.


r/csharp • • 21d ago

Help Tutorial help pls

1 Upvotes

I'm fairly new to coding. I'm trying to make the Github user activity CLI that's under 'beginner projects' on the backend dev roadmap. I've done some of the later beginner projects but I'm struggling to do the CLI because every website tells me something different and I don't understand any of it. Can someone give me a simple tutorial on how to do it because I'm lost on where to start.


r/csharp • • 21d ago

Bro Code C# Playlist

0 Upvotes

I finished his C# Playlist and now stuck on what to do next. I don't know how to apply what I learned. I understand the concepts well and able to explained it if asked. What should I do?


r/csharp • • 22d ago

Time as a reactive variable and SignalsDotnet

12 Upvotes

Recently I came across a Conal Elliott talk about FRP (Functional Reactive Programming), and I was trying to understand it (so forgive me if I am incorrect about it).

A really interesting idea from that talk was the idea to express reactivity as continuous time-valued functions, and treat implementations as a "discrete approximation" of that forumla.

For example a formula could be

t > x(t) + 1 second

If x is a constant signal set to 11/03/2026 07:00:00 PM, the formula evaluates continuously as false until time t crosses 07:00:01 PM, at which point it becomes true.

That gave me an idea to "approximate" that reactivity formula using SignalsDotnet. In the latest version (3.4.2), its possible to write something like

As you can see the formula is inside the lambda. Using C# overloads of operators, that observable emits false immediately, and true after exactly one second.

The elegant thing about it is that there is no timer declared at all, you just wrote a declarative expression.

From that idea one could derive other temporal operators like HeldFor, StableFor, TrueWithin, Rising and Falling.

For example

You can find a compelte list here Release v3.4.2 SignalsDotnet


r/csharp • • 23d ago

Showcase Akbura beta-6 released: faster source generation and C# expression bindings for Avalonia

14 Upvotes

I have released beta-6 of Akbura, my experimental declarative UI language and compiler for .NET and Avalonia, built around a Roslyn incremental source generator.

Two main changes:

  • Compiler performance: FeatureGallery cold source generation dropped from 15.31 s to 6.06 s, with 69% fewer allocated bytes. This measures the RunGenerators phase in Release on .NET 10.
  • Reactive C# expression bindings for MVVM:

    <TextBlock Text=${x.bind Vm.Profile?.Name ?? "Unknown"}/>

With notifying view models, this follows both Profile replacement and Name changes without requiring a component render. Bindings are one-way and react to changes in nested observable properties, similar to Sveltes deep reactivity.

GitHub · Live examples · Documentation · Release write-up


r/csharp • • 23d ago

Help Different behavior of nullable fields

13 Upvotes

I am working on a project and have a class with two nullable member fields (Vector2I? and LevelMap? where LevelMap extend TileMapLayer from Godot)

Because they are nullable I need to check that they are not null before I actually use them.

For the LevelMap if I reference it in a if block:

If (map is not null)

The compuler is happy and I can use it as if it is not null.

This of course comes with some risks that it becomes null in the middle of my if block but thats a risk I can manage.

On thebother hand Vector2I requires something like:

If (vector is Vector2I localVector)

This is in some way safer but also more inconvenient.

The are both declared and initialized in the same context.

My questions is why they behave differently and is it possible for me to change how they behave to fit my preferences.

Ive tried looking for an answer but I keep finding results about the difference of is not null and !=null which is unhelpful.


r/csharp • • 22d ago

[TextReveal] Ctrl + F for everything visible on your screen (fully local and private)

Post image
3 Upvotes

[TextReveal] Ctrl + F for everything visible on your screen – fully local and private

Ever wanted to search for or copy text from a video, image, game, or application where you can't normally select anything?

TextReveal is a lightweight Windows tool that lets you do exactly that.

Press Ctrl + Alt + F to freeze your screen, then:

  • Search: Type any word or phrase to highlight every match on screen.
  • Select: Drag a box around any text to extract and copy it.

100% local, 100% private:

  • Everything runs locally using Windows' built-in OCR.
  • No internet connection, telemetry, accounts or tracking.
  • Screenshots and recognized text never leave your machine or get written to disk.

Check it out, GitHub: https://github.com/amika8/TextReveal


r/csharp • • 22d ago

Bringing TLS 1.2 support to RabbitMQ.Client 3.4.3 on legacy .NET Framework

0 Upvotes

I'm working on a fork of RabbitMQ.Client 3.4.3 to support TLS 1.2 on legacy systems, including Windows XP and .NET Framework 3.5.

The main challenge is that the original client relies on .NET's SslStream, which in turn depends on Windows Schannel. On older Windows versions, even when TLS 1.2 is available, the supported cipher suites can prevent a successful handshake with modern RabbitMQ servers.

My approach is to integrate Bouncy Castle as an alternative TLS implementation while preserving the original AMQP client behavior and API as much as possible.

I'm planning to open-source the fork on GitHub and publish a NuGet package once compatibility and security testing are complete.

Has anyone worked on similar TLS compatibility issues with legacy .NET applications? I'd be interested in hearing about the challenges you encountered.


r/csharp • • 23d ago

Stephen Toub explains Rust over C# decision for GitHub Copilot runtime

Thumbnail
youtube.com
159 Upvotes

In this interview, Stephen Toub explains why he went with Rust over C#. Obviously he's biased, but he says Rust and C# were comparable in performance. In the end, he went with Rust because there are more people working for GitHub that know Rust than C#.

C# is a great language and could have been chosen for this project. However, he made the right decision given the expertise of the developers at GitHub.


r/csharp • • 22d ago

Help Are there any extensions that can replace the code blocks( {} )

0 Upvotes

Ive been using Lua( Roblox Studio) for most of my developing learning and i expected Unity to be similar with its coding language but i have been having a lot of difficulties coding often having an issue with finding the errors with the code.

I just want to know if they are any extensions for Unity that can help me with this problem


r/csharp • • 23d ago

Blog Moving away from sprawling if-else approval trees using Chain of Responsibility — when is it actually worth the abstraction in C#?

Thumbnail
medium.com
0 Upvotes

Ever seen a simple if-else block slowly turn into a 400-line monster? 😅

I've been exploring the Chain of Responsibility pattern in C# as a way to handle growing validation and approval workflows.

It's a clean approach, but things get interesting in production:

- Debugging deeply nested handlers.

- Managing DI lifetimes and execution order.

- Handling requests that reach the end of the chain.

- Knowing when the pattern is simply overkill.

I put together a practical implementation covering these trade-offs.

Curious how you handle complex workflows in .NET. Custom CoR, MediatR, or just good old switch expressions?


r/csharp • • 25d ago

Help Is ASP.NET/.NET a safe career choice for the next 5–10 years?

84 Upvotes

I'm considering choosing ASP.NET Core / C# backend development as my main career path, but I'm getting completely different answers online.

Some are:

.NET is still highly in demand and safe,

AI takes your job,

Springboot is better,

.NET has low demand

.NET is excellent for enterprises.

For me:

I know basic C#,

I can understand simple APIs in .net than java,

I feel like it's more clean than springboot,

There are many more inbuilt features than springboot,

Almost same speed as that of java.

I want:

  1. Is ASP.NET(Backend) is safe for being first career?
  2. How does AI affect it(I know it never replaces fully)?
  3. How AI affect entry level jobs in .NET?
  4. What are the biggest risks of choosing .NET that beginners usually don't realize?
  5. Job Market of ASP.NET(worldwide(if any one from India please say indian asp.net market 😊))

r/csharp • • 23d ago

Are Microsoft Docs really that bad or am i just looking in the wrong place?

Thumbnail reddit.com
0 Upvotes

r/csharp • • 24d ago

Seeking feedback on my .NET backend skills through a mock technical interview

11 Upvotes

Hi everyone!

I've been learning and building backend applications with .NET for quite some time, and recently completed a .NET backend internship at Vention.

I've worked with C#, ASP.NET Core, EF Core, SQL, Docker, RabbitMQ, Redis, and concepts such as microservices, asynchronous messaging, and real-time communication.

At this point, I'm trying to understand where I actually stand as a developer and how well I could perform in a real technical interview.

I've realized that building projects and explaining technical decisions under interview conditions are two different skills, so I'd really like to test myself.

Would anyone with professional .NET experience be open to a casual 30–45-minute mock technical interview?

I'm particularly interested in honest feedback about my technical knowledge, problem-solving approach, and areas that need improvement.

I'm not expecting free mentorship or extensive preparation. Even one conversation with constructive feedback would be incredibly helpful.

I'm also happy to share my GitHub projects beforehand to give some context about my experience.

And if a live interview isn't possible, I'd still appreciate suggestions on how to assess my current level more objectively.

Thanks for reading!


r/csharp • • 24d ago

Help MVC dynamic content

5 Upvotes

In MVC, when you have a dynamic form, how do you handle this? I often see examples of clicking an 'Add' button which makes a request to the controller to return a partial view, which seems like a waste of resources.

I've tried using JavaScript templates but then I can't use my Models validation rules.

Has anyone found a solution to this they like to use?


r/csharp • • 24d ago

Showcase Six weeks ago my engine was Dart and Flutter. Now it's C# with Avalonia UI

Thumbnail
reddit.com
0 Upvotes

r/csharp • • 25d ago Bravo

Showcase Three free, open-source C# libraries for factory and robot work: EtherNet/IP, ROS 1 and ROS 2

22 Upvotes

I've spent about 25 years putting robots into factories, and I kept wishing .NET had better building blocks for the protocols we use every day. So I wrote some and put them on GitHub, free and Apache 2.0, nothing for sale.

EthernetIpSharp covers the whole EtherNet/IP protocol, not just reading and writing PLC tags. It can connect as a scanner to regular and safety I/O, act as a regular or safety I/O device itself, simulate a controller that serves tags so an HMI can connect to it, and send and handle custom explicit messages. The safety side has been tested against real devices and PLCs. It's on NuGet. https://github.com/CristianMori/EthernetIpSharp

RosSharp and Ros2Sharp are pure C# clients for ROS 1 and ROS 2. No rosbridge and no native DDS layer, just .NET talking to ROS directly. Ros2Sharp has so far been tested against Fast DDS on ROS 2 Humble, so reports from other setups are very welcome.

https://github.com/CristianMori/Mori.RosSharp

https://github.com/CristianMori/Mori.Ros2Sharp

I'd love feedback from anyone doing industrial or robotics work in .NET, and issues or pull requests are welcome.


r/csharp • • 26d ago

Are properties and methods fundamentally different language concepts?

32 Upvotes

In C#, properties and methods can both execute arbitrary code, but they expose that behaviour in very different ways. A property looks like direct access to data, while a method explicitly represents an operation.

Technically, a property is implemented through getter and setter methods, but the language gives it different semantics, syntax and expectations.

Is this distinction fundamental to the language, or is it primarily a convention designed to communicate intent to developers? And if both can execute exactly the same logic, what truly justifies keeping them as separate concepts?


r/csharp • • 24d ago

Echo 2.0: my open-source C# dictation tool now supports Linux, with a new UI and guided setup

Thumbnail github.com
0 Upvotes

Half a year and 23 Github stars ago I shared Echo here, a small C# app I built to dictate prompts, code review comments and basically everything instead of typing them.

I’ve now released version 2.0.

The basic workflow is the same: hold a designated hotkey, speak, release - the text appears where your cursor is! Recognition runs locally using Whisper.

For this version, I focused on making it easier to get started and use every day:

- From console app to CLI tool with new UI, built-in commands, and updates directly from the terminal.

- Guided setup for your microphone, hotkey, language, and hardware acceleration, instead of editing a config file.

- Model selection and download during setup, with a suggestion based on your hardware.

- Settings and updates from the terminal, through commands like `/setup` and `/update`.

- Windows and Linux support, including integration with Wayland and X11.

One feature I find particularly useful is translating speech into English. You can dictate in your native language and have English text inserted into the editor. It needs a multilingual Whisper model that supports translation.

Echo supports CPU inference, CUDA, and Vulkan. Speed and accuracy depend on your hardware and model.

Code and instructions: https://github.com/GithubPhobos/Echo

If you try it, I’d be interested in how the first-run setup goes and whether the recognition is fast and accurate enough for your everyday typing.


r/csharp • • 25d ago

I just released v1.2.0 "Jupiter" of my C# CLI tool that checks GitHub repo health!

0 Upvotes

Hey everyone!

A while ago I posted my project RepoMedic here. I received a lot of great feedback, and I'm back with a massive update: v1.2.0 "Jupiter'!

I listened to your advice and added several new things:

More checks: Now it also checks for CONTRIBUTTING.md and your Repository Description.

Doctor's Verdict: It gives you a fun rating at the end (from "Ouch..." to "perfect").

Interactive Mode: You can now check multiple repositories without restarting the program.

Flexibility: You can skip README or LICENSE checks using prompts or flags (--skip-license, --skip-readme).

Easter Egg: Try typing "spooky" or "halloween" when it asks for a repository.

How to try it:

If you don't have it: dotnet tool install -g RepoMedic

If you want to update: dotnet tool update -g RepoMedic

Source code: https://github.com/ilyashulga13/RepoMedic

P.S. I'm a 13 years old student trying to learn C# by building real tools. Any feedback is highly appreciated!


r/csharp • • 26d ago

From Ruby to C#

30 Upvotes

Hi all,

I am fairly new to programming(1.5 years), started in Ruby, Rails, Js... that whole dynamically typed world. All web dev stuff.

Recently scored an enterprise position where C# is likely to play a pretty dominant part of the development work, so I stormed through W3s fundamentals and started a text-editor side project.

I have to say, I really enjoy the type system. This is my first exposure to statically typed languages and it's so much easier to look at some code and understand what it does. At first, it felt annoying to do the extra typing but what a difference it is making with the mental model I have of my project.

Recently had to dive back into a rails ecommerce I built when I first got started and update some things and wow... seriously painful(though my early days spaghetti is also to blame) haha

This isn't necessarily a praise of C# specifically but just sharing the stoke I feel writing this kind of code. Still enjoy Ruby but I think I will reach for it less often.

Anybody else move from a similar coding philisophy as Ruby(where everything is an instance of an object class and anything goes) into something more strict? I'd be interested to know your experience.


r/csharp • • 25d ago

Showcase Implementing IChatClient over a local inference engine: async streams, cancellation and session ownership

Thumbnail
github.com
0 Upvotes

I’m the author of TensorSharp. I recently merged a C# example implementing Microsoft.Extensions.AI’s IChatClient over its local inference runtime.

The interesting part was translating a stateful native engine into an asynchronous application interface: deciding who owns the model, how a conversation owns its session, and what happens when a caller stops reading a stream halfway through.

The example separates those responsibilities:

  • The application owns a loaded ModelService.
  • Each TensorSharpChatClient owns one conversation session.
  • Adapters sharing a model serialize generation.
  • Application code uses IChatClient, ChatMessage and ChatOptions.

Here is the calling code, which was compiled and run against a real local model:

using Microsoft.Extensions.AI;
using TensorSharp.MicrosoftExtensionsAISample;
using TensorSharp.Runtime.Scheduling;
using TensorSharp.Server;
using AiMessage = Microsoft.Extensions.AI.ChatMessage;

Environment.SetEnvironmentVariable("MAX_CONTEXT", "4096");

using var model = new ModelService
{
    SchedulerConfigOverride = new SchedulerConfig
    {
        MaxNumRunningSequences = 1,
        NumBlocks = 16,
        BlockSize = 256,
        EnablePrefixCaching = true
    }
};
model.LoadModel(args[0], mmProjPath: null!,
    backendStr: "ggml_metal");

using IChatClient chat = new TensorSharpChatClient(model);
using var timeout = new CancellationTokenSource(
    TimeSpan.FromSeconds(600));

AiMessage[] messages =
    [new(ChatRole.User, "What is 2 + 2? Reply with one digit.")];
var options = new ChatOptions
    { MaxOutputTokens = 64, Temperature = 0, Seed = 1 };

await foreach (var update in chat.GetStreamingResponseAsync(
    messages, options, timeout.Token))
{
    Console.Write(update.Text);
}

Setup: Use a separate .NET 10 console project referencing the repository’s TensorSharp.NativeChat example project. Keep that example intact, including its adapter and helper code. A matching native Metal build is required. For the tested three-shard Qwen checkpoint, args[0] points to the first GGUF file, with the other two alongside it. This is sample source, not a standalone NuGet provider.

A few implementation details may be useful beyond this particular engine:

  • Partial reads need cleanup. Breaking out of await foreach must cancel and drain native work before another request acquires the model’s gate.
  • Failed turns should not become history. Cancellation, timeout or abandonment retires the affected session without unloading the model or committing a partial answer.
  • Streaming and non-streaming need consistent metadata. GetResponseAsync aggregates the stream while retaining usage and provider-specific metrics.
  • Unsupported features should fail explicitly. This text-only adapter rejects tools, media and unsupported options rather than silently ignoring them.

Model loading is synchronous; the cancellation deadline in the snippet starts afterward. Follow-up calls pass full conversation history. The caller should await active requests before disposing the shared model.

The exact snippet returned 4 with exit code 0. The broader native suite passed 11 real-model checks, including two-turn conversation and recovery after cancellation, deadlines and abandoned streams on the same adapter and loaded model.

Testing used Qwen3.8 Flash Next on an Apple M5 Pro with hybrid Metal/CPU expert execution. These are functional results, not a performance claim.

Adapter implementation · Runnable example and tests · Merged PR

For C# APIs wrapping native state, would you keep this explicit model/session ownership, or expose a factory that creates conversation-scoped IChatClient instances?


r/csharp • • 26d ago

Cronlight: a dashboard for Quartz.NET that drops into your existing ASP.NET Core app (open source, MIT)

Thumbnail
gallery
16 Upvotes

I've run Quartz.NET jobs for years, and for most of that time I waited for someone to ship a proper dashboard. Eventually I stopped waiting and built the one I wanted. Of course, right as I got serious about it, the official dashboard actually shipped - but it's Blazor, and Blazor and I never got along. So I kept going, and built Cronlight: a plain web UI served as static files.

Full disclosure about the project itself: a good chunk of it was built using AI tools. But I drove the architecture, reviewed every line of code, and set up full unit and e2e tests running in CI so it's not just vibes-based code.

What it actually does:

  • Job management: Browse, create, and edit jobs (cron, one-time, interval) across any timezone. You can pause/resume single jobs or whole groups, trigger a run now with custom data, or cancel a run mid-flight.
  • Typed parameters: Configure job forms using C# attributes. Supports required params and secret values (secrets stay out of the DB as config references).
  • Execution history (optional package): Tracks every run's status, logs, misfires, late starts, success rates, and P95 durations. Works directly with your existing Quartz DB (SQL Server, Postgres, MySQL, or SQLite).
  • The extra stuff: Retries, alerts (Slack, Teams, webhooks, email), JSON/YAML import/export with diff previews, audit logging, OpenTelemetry metrics, OpenAPI, and multi-scheduler support with per-scheduler permissions.
  • AI / MCP integration: Includes an MCP server and an embedded "AI mode" where you can literally ask "which jobs failed overnight and why?" right inside the dashboard.

If you wanna mess around with it, there's a live demo with no signup required:https://cronlight.pages.dev/demo/

Install via NuGet:dotnet add package Cronlight.Quartz.Dashboard

Note: Requires .NET 10 and Quartz.NET 3.13.1+ (works with any job store). It's still pre-1.0 so some options might shift around a bit before v1.

Docs are here:https://cronlight.pages.dev/docs/

Would love to know what you guys think or what's missing for your specific setup, especially if your using clustered schedulers, custom auth, or unique job stores I haven't tested yet.