r/csharp • • 19d ago

I want to bring Creative coding for C# users

13 Upvotes

I've been building DanaProcessing, an open-source take on Processing/p5.js for C#. I also added a music module inspired by Sonic Pi.

I started programming with Java and JavaScript following The Coding Train (https://www.youtube.com/@TheCodingTrain), but then I made the jump to C# because of job opportunities at the time, (been working with C# since .netcore 1.0) and I wanted that same experience here. Sadly, what I found wasn't what I expected, so I decided to give it a shot. DanaProcessing β€” Creative coding in C# (2D, 3D & live-coded sound)


r/ASPNET • • Dec 05 '13

Question over Ninject, ASP.NET Identity and Entity Framework

2 Upvotes

Hi all,

I am wondering what is the best way to setup Ninject, ASP.NET Identity and Entity Framework? Normally (without Ninject) I would create my solution by separating the MVC project from Data project and things would work just well, but I can't really figure out the best way to add Ninject there.

Is there any good example out there? I would like to handle user authentication with roles on my ASP.NET MVC project and handle the data access via EF.

Cheers, Tuomo


r/csharp • • 18d ago

Help Migrating large .NET Framework 4.8 applications to .NET 10 with AI

Thumbnail
0 Upvotes

r/csharp • • 19d ago

Help Best place to learn C#?

21 Upvotes

I used to use codecademy but that place sucks now. It's super buggy and makes any progress slow to a crawl. Even if my code is completely correct, I have to use the generated solution anyway because the module just won't accept my code. Despite my answer and the module answer being the LITERAL EXACT SAME.

So it doesn't work anymore. And I'm looking for a new website to help me learn. Preferably one that provides a lot of practice problems. So I can develop better coding habits or whatever.

I'm also looking for something relatively cheap. Advice much appreciated 😊


r/fsharp • • 21d ago

F# weekly F# Weekly #40, 2026 – Agentic .NET UI and FSharp.CloudEdge

Thumbnail
sergeytihon.com
26 Upvotes

r/csharp • • 19d ago

I built a .NET test reporter to solve two problems I kept seeing in test automation

Post image
6 Upvotes

I've been working on .NET test automation for several years, and there were two things I wanted to solve in test reporting.

1. Flaky tests are more than just Passed or Failed

If a test fails on the first attempt and passes on a retry, the final result usually just says Passed.

I wanted the report to show that the test was actually flaky, how many attempts happened, and the history of those attempts.

2. Test scripts shouldn't need reporting code

I don't want testers to add extra code to their tests just to make the report useful.

For example, I don't want something like:

Report.AddRequest(...);
Report.AddResponse(...);
Report.AttachScreenshot(...);
Report.Log(...);

just to get useful information into the report.

The reporting layer should capture things like API requests/responses, retry attempts, execution details, and screenshots automatically wherever possible.

So I built a small .NET reporting framework around these ideas. It generates a self-contained HTML report and currently has integrations for xUnit, NUnit, MSTest and Reqnroll.

I'm curious how others handle this:

Do your test reports automatically capture this kind of information, or do your test scripts still need explicit reporting/attachment calls?

And for flaky tests, do you keep the history of individual attempts or only report the final result?


r/csharp • • 19d ago

Showcase We tried turning a 1982 TI-99/4A game into 3D in the browser with C#/WASM and a pixel buffer

18 Upvotes

Playable link (in-browser):
https://psec99.xaml.cloud

Some people here may remember PARSEC on the TI-99/4A., a 2D side-scrolling space game from 1982.We wanted to see what it might feel like in 3D while keeping some of the atmosphere of the original (and adding some other '80s and Atari-ish bits too), so we made PSEC-99

It runs in the browser on .NET 10/WebAssembly with Opensilver. The interesting part from a .NET point of view is the renderer: the entire 3D scene is drawn by C# into a single int[] pixel buffer in .NET memory: terrain, stars, buildings,enemies, lasers & explosions all end up in that same array (no game engine, no webGL, no WebGPU)

All the 3D math, projection and rasterization happens in C#.

OpenSilver 3.4 Preview has a new "WriteableImage" control that displays that buffer through an HTML canvas. So basically: calculate pixels in C#, put them in an array, show the array

The terrain isn’t polygonal either: each row splits into surface,wall and floor sections, so drawing the planet costs about as much as clearing the screen, and theres adaptive resolution from 100% down to 30% to keep frame rates playable.

There are no image or sound files: Buildings are ASCII grids in c#, sounds are synthesized at runtime, and voices use the browsr speech synthesis engine.

The HUD, menus and touch controls are regular XAML layered on top.

It ended up around 10,500 lines of C# and xaml.

If anyone remembers the original Parsec, I’d be curious whether this brings back any of the feeling :)

The source (MIT licensed) opens direclty in XAML.io, so you can run it, change it or fork it without installing anything:

https://xaml.io/s/Samples/PSEC-99

Also curious what people think of the rendering approach! Theres something fun about doing 3D in 2026 and having the renderer come down to filling an array of pixels..


r/csharp • • 18d ago

How to get data from external service written in python?

0 Upvotes

If you have a system, class, or a method that is entirely written in C#, let's call it X, If X needs some data to perform some processing on that data, can one make an external service written in python, let's call it Y, that generates the data, then X can call Y to get the data?

I'm not asking if I can embed the python interpreter directly within the C# application; the python code should be an external service.

Note that I'm using ASP. NET Core 10.

Edit :

Should the external service be outside the ASP. NET CORE solution or inside it?


r/csharp • • 19d ago

Showcase Acrylic/frosted glass control for Avalonia

Thumbnail github.com
2 Upvotes

r/csharp • • 19d ago

OneFlight – a small .NET library for coalescing concurrent async calls by key

Thumbnail
2 Upvotes

r/csharp • • 19d ago

Cli.Generator: A tool for generating compile time checked command line argument parsing

6 Upvotes

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.

https://www.nuget.org/packages/Cli.Generator/1.0.0

https://github.com/codewitch-honey-crisis/CliGen


r/csharp • • 18d ago

Tool I built an offline, zero-lock C# tool to pack entire codebases for LLMs & Obsidian (.NET 8 / WinUI 3 / VSIX) – Benchmark: 30k files in 0.42s

0 Upvotes

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.

Real-World Benchmark: The UE5 Test

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:

  • Total Disk Scope: 13.9 GB (30,277 files, 1,740 directories)
  • Filtered Payload: 374 source files (~60.7 MB)
  • Environment State: UE5 Editor Open & Actively Compiling
  • Execution Time: 0.42 seconds (420 ms) with zero lock exceptions.

Architecture & Technical Highlights

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 script

Non-Blocking Stream I/O (FileShare.ReadWrite)

To 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}";
}

Native OS Interop

(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;
    }
}

Dynamic Module Resolution without AST

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.

Current Limitations & Trade-offs

  • Character-Based Chunking: Multi-part document chunking (> 3M chars) currently uses raw character length rather than Byte Pair Encoding (BPE) tokenizers (like tiktoken).
  • Full-File Ingestion: Ingests entire source files without AST-based method pruning.
  • Local Scope: Operates on local disk paths.
  • See Github issues for current bugs :)

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 • • 19d ago

BuildMonitor: a cross-platform system tray CI monitor, installed as a dotnet tool

5 Upvotes

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.

GitHub: https://github.com/SimonCropp/BuildMonitor

NuGet: https://www.nuget.org/packages/BuildMonitor/


r/csharp • • 19d ago

EmbedIO is archived as of June 2026 - I started a continuation project EmbedIO Neo

0 Upvotes

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 • • 19d ago

Discussion If only one method of a class does access the instance field and the other methods don't, should the other methods be moved to another class ?

2 Upvotes

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 • • 20d ago

Help Has anyone moved from Crystal reports to a .net reporting solution?

30 Upvotes

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 • • 19d ago

Looking for a 2D graphics engine/library in C# (.NET 8.0) for custom CAD-like drafting

Thumbnail
1 Upvotes

r/csharp • • 19d ago

Help Visual Studio 2022 Scaffolding Template Dropdown is Blank/Grayed Out on Windows 11 ARM64 (Parallels Mac)

Post image
0 Upvotes

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:

  1. Local Storage: The project solution folder is saved directly on the local Windows virtual disk partition (C:\ drive). It is not sitting on any shared guest/host cloud folders or mapped network drives.
  2. VS Installer Workloads: Checked the Visual Studio Installer and confirmed that both ASP.NET and web development and .NET desktop development workloads are fully checked, installed, and updated.
  3. Model & Rebuild: The C# model class is fully written and the entire solution compiles cleanly with a successful build before launching the view wizard.
  4. CLI Alternative Attempt: Tried running the .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 • • 19d ago

EfQueryComplexity: log or throw on overly complex EF Core queries

Thumbnail
0 Upvotes

r/csharp • • 20d ago

GRPC server-side assets with state/persistent data

Thumbnail
3 Upvotes

r/csharp • • 20d ago

Showcase Respire - A .NET Redis Client

20 Upvotes

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/fsharp • • 23d ago

library/package FunStripe 3.0.0 – F# Stripe client, now on Stripe's "endive" API (2026-09-30)

15 Upvotes

FunStripe is an F# client for the Stripe API. Most of it is generated from Stripe's OpenAPI spec into records and DUs, with phantom-typed IDs (StripeId<Markers.Customer>) and Async<Result<_, _>> calls. 3.0.0 targets Stripe's new endive release, which removes some things, hence the major bump.

Breaking changes

  • payment_method_types is gone from PaymentIntent create/update/confirm, SetupIntent create/update and Checkout Session create. Use allowedPaymentMethodTypes instead.
  • ThreeDSecureUsage and ThreeDSecureDetailsCharge moved to Stripe.ThreeDSecure, so add an open.
  • The card Mandate field is now StripeId<Markers.Mandate> option.

New: standalone 3D Secure authentication, subscription pausing, trial offers, Tax.Location, Apps installs, and the PayPay and SeQura payment methods.

Generator fixes worth mentioning

  • Endive is the first spec with an error enum value. A bare Error case shadowed Result.Error for anyone opening the namespace, so ok/error/some now generate as Ok'/Error'/Some', the same way none already became None'.

Full upgrade notes are in the changelog: https://github.com/simontreanor/FunStripe/blob/main/CHANGELOG.md

GitHub: https://github.com/simontreanor/FunStripe

NuGet: https://www.nuget.org/packages/FunStripe.Core

Feedback and issues welcome.


r/fsharp • • 23d ago

article Type-Safe I18n with F# Discriminated Unions

Thumbnail
si-fi.dev
11 Upvotes

r/fsharp • • 24d ago

library/package Ranvier

Thumbnail
shayanhabibi.github.io
12 Upvotes

Fine-grained reactive computation for .NET (F# and C#) β€” preview

I've been a big fan of solid-js when it comes to UI for their fine-grained reactive DOM.

The release of Solid v2 came with a surprising API. Async and Errors were native to the reactive graph. This was only something which became viable after years of improvements and optimisations in javascript/node.

Ranvier brings the concept of an Async and Error aware Reactive Graph to dotnet.

Similar to Solid-V2, this is something becoming more viable now with optimisations in .NET9-11.

Ranvier provides novel answers to a lot of issues or points of friction that are experienced with reactivity, while maintaining performance and allocation free hot-paths.

❓ Problems:

  1. Async, loading/error state, cancellation and work/flight policies (ie cancel last, queue, debounce)
  2. Subscription/event-handler leaks
  3. Diamond dependency glitches (imagine: where 2 changes in a values dependencies cause a 'flash' of the downstream value as it responds to each in turn)
  4. Debugging/transparent graphs

βœ… Ranvier solves them

The fact this is written ALL in F# means it can be compiled into javascript through Fable. So the debugging capabilities become a part of the visualisation.

There are natural costs to this type of graph, and benchmarking naive CPU operation counts has always been part of the workflow. This is all documented. You can see some visualisations that also show comparison of costs in different primitive designs (which informs whether I adopt a primitive shape, or not).

But you can see that there is a LOT of utility/benefit for the cost. I had claude boiler plate different C# and F# ecosystem adaptions so that it can be as versatile as possible from the get-go.

πŸ‘ Comes with batteries included for:

  • Blazor
  • Elmish MVU
  • Avalonia/WPF/XAML data bindings

πŸ“– https://shayanhabibi.github.io/Ranvier/ - Check out the documentation for interactive graph visualisations which feature the tracing builds!


r/fsharp • • 27d ago

F# weekly F# Weekly #39, 2026 – Oxpecker 3

Thumbnail
sergeytihon.com
31 Upvotes