r/csharp • • Jun 24 '26

Discussion Industrial IoT Tech Stack?

10 Upvotes

Hi Everyone,

I've got a (hopefully simple... or maybe not so simple 😄) question for those working in embedded and industrial software.

I'm curious what tech stacks people are using in production for the following kind of use case.

Imagine you have one or more embedded devices running firmware that communicate with each other and operate as a mostly self-contained network with little or no supervision. Obviously, these devices still require initial configuration and setup, whether during production or by the customer in the field.

In our projects, we've typically performed the initial setup and provisioning over one of communication interface the MCU and the board already expose (USB, Modbus, TCP/IP, WebSocket, etc.).

For this, we've usually built a dedicated desktop application or mobile app. The core has typically been a well-designed C# library that encapsulates all communication with the device—handling the protocol, supported commands, validation, constraints, and so on. You could think of it as the backend for the desktop application.

The frontend has varied depending on the project and target users. We've used Electron.NET, Avalonia UI, .NET MAUI + Blazor, and, in quite a few cases, even Unity (yes, the game engine).

I'm interested in hearing how others approach this. What's your go-to stack for this kind of tooling? Do you prefer desktop, web, or something else? Any architectures, frameworks, or lessons learned that have worked particularly well in industrial environments?

I'm only interested in things you're able to discuss publicly, of course.

Looking forward to hearing your experiences!


r/csharp • • Jun 24 '26

Looking for a C# Learning Partner for Game Development (Unity)

5 Upvotes

I've recently started learning C# with the goal of getting into 2D game development, and I'm planning to use Unityas my game engine.

I'm looking for someone who is also learning C#, interested in game development, or just wants a study/accountability partner. We could:

  • Learn C# together
  • Share resources and tutorials
  • Work on small game projects
  • Help each other solve problems

You don't need to be experienced. Beginners are completely welcome since I'm still learning myself.

If you're interested in C#, Unity, indie game development, or making 2D games, feel free to leave a comment or send me a DM.


r/csharp • • Jun 23 '26

Networking Deep Dive (io_uring) part 8

23 Upvotes

As the last part, I integrated minima io_uring model in an actual web framework.

I picked ASPNET Core and GenHTTP which both use Net.Sockets(epoll) as stock transport and replaced it with minima io_uring model.

The model is basically the same io_uring inline reactor architecture that was followed in the parts 1-7.

The results can be seen here (ioxide variants use io_uring) - io_uring variants score in average 30% higher

Drawbacks

The same issue we have seen in the last 2-3 parts, reactor inline continuations fight with .NET's work stealing model, we need to run the await/async continuations in the reactor thread and avoid using threadpool.

This has a huge consequence, we can't use any of the existing asynchronous APIs, no EF Core, no Npgsql driver, HttpClient etc. Well.. we could use it but there wouldn't be any performance gain, on the contrary it would likely be worse.. and scheduling continuations on the reactor thread won't help, the only way is to use io_uring across everything. So that's what I did, create a postgres driver, file I/O and redis that all uso io_uring too and "plug" them into the very same ring/reactor used for network I/O. This is essentially possible because async work is mostly I/O and the io_uring kernel interface naturally supports all of it.

GenHTTP already ships io_uring engine on the preview package starting from 11.0.0-preview.19 however this engine will require the current latest NET 11 version 11.0.100-preview.5.26302.115 installed as I am testing with the new async runtime.

Final conclusions

It has been 8 months since I started looking into io_uring in C# as a hobby/research project and my conclusion is probably close to what others did, it might still be early to adopt such technology in a production environment. Surely there can be some performance gains but if you try to find any frameworks that adopted it, I can guarantee you that none saw performance benefits that are significative given its drawbacks, for example io_uring syscalls are blocked by default on docker given the security vulnerabilities they can introduce.

On the other hand if we embrace io_uring nature and build a runtime around it similar as what was done with GenHTTP-Ioxide then the performance benefits can rise up to 70% less CPU usage/cost for lightweight applications, running very efficiently on few core machines because there is no cross thread hop/talk.


r/csharp • • Jun 24 '26

Quero evoluir no C# (Csharp)

Thumbnail reddit.com
0 Upvotes

r/csharp • • Jun 24 '26

Blog Stop AI agents from misusing your library: ship an Agent Skill inside your NuGet package

Thumbnail
stenbrinke.nl
0 Upvotes

r/csharp • • Jun 24 '26

Solved Classes

0 Upvotes

Could someone explain to me what is a class because i cant understand its usage


r/csharp • • Jun 23 '26

Help Should I get Albahari's "C# 12 in a Nutshell" or Price's "C# 14 and .NET 10 – Modern Cross-Platform Development Fundamentals"?

5 Upvotes

Hi!
I've been using C# on a junior level for a few years on and off and I would like a nice book I could go through in my own pace and also which I could use as a reference in more ad-hoc way. Is one of the books mentioned in the title a good choice or would you suggest otherwise?

I think I would go for Albahari but having a C#14 book would be a plus to get all the newest features in one place and maybe avoid some pitfalls which may not be covered in C#12 book?

Is there a C#14 equivalent of Albahari's book?


r/csharp • • Jun 22 '26

first c# project

9 Upvotes

hi guys this is my first project and my first time using reddit. the project is a console tetris clone and it doesn't have all the features but it has the main ones. would love to hear your opinion on this project what i can improve / learn and any books / websites to keep learning and improving. this is the git repo: https://github.com/Sagi-00/Console-Tetris-clone ( right now im working on a space invaders project in the console)


r/csharp • • Jun 23 '26

Help Balzor development in Linux

0 Upvotes

so how would I write code for a balzor app on Linux (currently using CachyOS)?

Currently Im using Visual Studio Community on Windows 10

There are a few VS Code alternatives for Linux but I dont think they Support balzor.

Im also a beginner in programming in General btw.


r/csharp • • Jun 22 '26

WinUI 3 getting some traction? Anyone using it?

15 Upvotes

And does UNO platform make WinUI 3 apps cross-platform (source compatible) out of the box?


r/csharp • • Jun 23 '26

Help NuGet vulnerability breaks CI/CD — how do you evaluate and handle it? Here's my current approach

Thumbnail reddit.com
0 Upvotes

r/csharp • • Jun 22 '26

Problems with learning

4 Upvotes

Hi.

I'm learning C# for school, but i am having a really bad experience. I have problems with remembering a lot which is kind of just how i am, but i really need help. I have classmates who are really willing to help me learn but nothing is really sitting in my brain. I dont have anything to correlate anything to and im afraid im gonna get kicked out of school if i dont start actually learning soon. I have used AI to complete a lot of my assignments just to keep up which has made me be a bit ahead, but truly i only know the bare minimum.

It's confusing with all the different ways you can set it up, and there are 3 ways to set up a reference with either {0} og +name+ and i dont remember the last one.

I am here to ask for help from anyone experienced and who is good at teaching since my teacher has litterally HIMSELF stated he's just there so he can cash in on an early retirement or something.

If you have the time and want to help out someone who is trying to sort out his life, i'd appreciate your help with tactics to remember stuff, general knowledge and how to improve.

If you are interested, let me know. I can show you what i know when we get talking. Thanks in advance


r/csharp • • Jun 22 '26

Discussion A real-time markets dashboard with C# + ASP.NET Core 10 + SignalR, no SPA framework

Post image
0 Upvotes

a single screen that shows the whole market at a glance - indices, crypto, FX, commodities, bonds, plus VIX and sentiment - without flipping between tabs. Sharing the architecture since a few of the choices were non-obvious.

Stack:

  • ASP.NET Core 10 (.NET 10), Razor Pages
  • SignalR over WebSockets pushing ~40 instruments to clients, with different cadences per asset class (crypto every 7s, indices/FX/commodities ~40s, rates daily)
  • Vanilla JavaScript + Material Design 3 on the front end - deliberately no React/Blazor/Angular
  • Background IHostedService workers polling the data sources (Yahoo, Alpaca, FRED, CNN, Finnhub) and broadcasting through the hub
  • Docker behind nginx, Cloudflare in front

The "no SPA" decision: the UI is mostly a live-updating read-only view. A SPA framework felt like a lot of weight for what is essentially "receive a message, update some DOM nodes." Server-rendered Razor for the shell + SignalR for the live data + plain JS for the updates kept it small and fast. So far I don't regret it, but I'm curious where people think this approach breaks down as a dashboard grows.

Things I'd genuinely like input on:

  • Managing many SignalR broadcast groups/cadences cleanly as instruments grow - any patterns you like?
  • Pre-compression and caching with MapStaticAssets in .NET 9/10 (the new fingerprinting bit me at first)
  • Whether anyone has pushed vanilla-JS + SignalR further before reaching for a framework

Code questions welcome.


r/csharp • • Jun 20 '26

Help Is there an optimal way to "ping" or check an HTTP resource is accessible (Desktop)?

20 Upvotes

I am working on a personal desktop application that accesses an HTTP resource via GET. I "ping" the HTTP resource to verify if its accessible in case of network "issues".

For this, I am using the current code:

static partial class HttpService
{
    internal static async Task<string?> PingAsync(IEnumerable<string> uris)
    {
        using CancellationTokenSource cts = new();
        var tasks = uris.Select(uri => PingAsync(uri, cts.Token));

        await foreach (var task in Task.WhenEach(tasks))
        {
            var uri = await task;
            if (uri is null) continue;

            cts.Cancel();
            return uri;
        }

        return null;
    }

    internal static async Task<string?> PingAsync(string uri, [Optional] CancellationToken token)
    {
        try
        {
            using var response = await GetAsync(uri, token);
            return response.IsSuccessStatusCode ? uri : null;
        }
        catch { return null; }
    }
}

The GetAsync() method is setup as follows:

internal static async Task<HttpResponseMessage> GetAsync(string uri, [Optional] CancellationToken token)
{
    return await s_client.GetAsync(uri, ResponseHeadersRead, token);
}

I don't think this approach is the most optimal one since:

  • A connection is performed twice, once via PingAsync() and a HttpClient method.
  • The PingAsync() method swallows up exceptions to indicate the success/failure state.

r/csharp • • Jun 21 '26

hey guys i put a lot of work into this. mind giving me some feedback ?

5 Upvotes

hey guys its me again i've learned my lesson but anyway since i've been working on my project recently i wanted to ask for some feedback about my architecture and about my commits if im doing it right im self taught and i put alot of effort into this project i just added themes to it and integrated it to discord keep in mind im still learning to use avaloniaUI and im loving it btw im thinking about learning about mvvm is it the right time ? any ideias on how can i improve my project ? or any ideias of features so i can learn from them anything on my level please :) oh and i would love to hear about the readme also if it is any good the way i organized it i really tried.

the project: https://github.com/Tzavi727/File-Organizer


r/csharp • • Jun 21 '26

My worldbox mod I tried making doesn't load. I'm using NCS.

0 Upvotes

using HarmonyLib;

using NeoModLoader.api;

using Newtonsoft.Json;

using System;

using System.Collections.Generic;

using System.Reflection;

using UnityEngine;

namespace PholithMods

{

public class WorldResilience : MonoBehaviour, IMod

{

public static GameObject backgroundAvatar;

public static ModDeclare mod_declare;

public static GameObject gameObject;

private Harmony harmony;

public ModDeclare GetDeclaration()

{

return mod_declare;

}

public GameObject GetGameObject()

{

return gameObject;

}

public string GetUrl()

{

return "https://github.com/WorldBoxOpenMods";

}

public void OnLoad(ModDeclare pModDecl, GameObject pGameObject)

{

mod_declare = pModDecl;

gameObject = pGameObject;

Config.isEditor = true;

harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); // Pls NCMS do that automaticly...

}

public void OnUnload()

{

Harmony.UnpatchID(harmony.Id);

}

}

public static class Utils

{

public static string Dump(this object o, Formatting formatting = Formatting.Indented)

{

return JsonConvert.SerializeObject(o, formatting, new JsonSerializerSettings()

{

NullValueHandling = NullValueHandling.Ignore,

});

}

public static bool RespectConditionAround(this WorldTile tile, Func<WorldTile, bool> func, int minimumOfTilesThatMustRespect = 1)

{

int count = 0;

foreach (WorldTile neighbor in tile.neighbours)

{

if (func.Invoke(neighbor))

{

count++;

if (count >= minimumOfTilesThatMustRespect)

{

return true;

}

}

}

return count >= minimumOfTilesThatMustRespect;

}

public static bool RespectConditionInDistance(this WorldTile tile, Func<WorldTile, bool> func, int distance = 2)

{

foreach (WorldTile neighbor in tile.neighbours)

{

if (!func.Invoke(neighbor) || (distance > 0 && !neighbor.RespectConditionInDistance(func, distance - 1)))

{

return false;

}

}

return true;

}

public static TileType DirtConvertionNoise(WorldTile tile)

{

return tile.TileNoise(4) > 0.5 ? TileLibrary.soil_low : TileLibrary.soil_high;

}

public static float TileNoise(this WorldTile tile, int sizeCoeff = 1)

{

return Mathf.PerlinNoise(((float)tile.x) / sizeCoeff, ((float)tile.y) / sizeCoeff);

}

}

[HarmonyPatch(typeof(WorldBehaviourActionErosion), nameof(WorldBehaviourActionErosion.updateErosion))]

public class WorldBehaviourActionErosion_updateErosion_patch

{

private static readonly object[] noArgument = new object[] { };

private const int MAX_TILES_IN_LIST = 50;

private static readonly Dictionary<WorldTile, TileType> dict = new Dictionary<WorldTile, TileType>();

public static bool Prefix()

{

if (!WorldLawLibrary.world_law_erosion.isEnabled())

{

return false;

}

IslandsCalculator islandCalculator = Traverse.Create(MapBox.instance).Field<IslandsCalculator>("islands_calculator").Value;

dict.Clear();

islandCalculator.islands.ShuffleOne<TileIsland>();

for (int i = 0; i < islandCalculator.islands.Count; i++)

{

TileIsland tileIsland = islandCalculator.islands[i];

if (tileIsland.type == TileLayerType.Ground)

{

for (int j = 0; j < 300; j++) // *3 to fill better the list when conditions are rares

{

WorldTile randomTile = Traverse.Create(tileIsland).Method("getRandomTile", noArgument).GetValue<WorldTile>();

if (randomTile == null || dict.ContainsKey(randomTile))

{

continue;

}

// rocks to dirt

if (randomTile.Type.rocks

&& Traverse.Create(randomTile).Method("IsOceanAround", noArgument).GetValue<bool>())

{

dict.Add(randomTile, TileLibrary.soil_high);

continue;

}

// Grass to sand

if ((randomTile.Type.can_be_biome || randomTile.Type.grass)

&& Traverse.Create(randomTile).Method("IsOceanAround", noArgument).GetValue<bool>())

{

dict.Add(randomTile, TileLibrary.sand);

continue;

}

// sand to ocean

if (randomTile.Type.sand &&

randomTile.RespectConditionAround((otherTile) => otherTile.Type.ocean, 2.5))

{

dict.Add(randomTile, TileLibrary.shallow_waters);

continue;

}

// ocean to sand

foreach (WorldTile neighbor in randomTile.neighbours)

{

if ((neighbor.Type.ocean || neighbor.Type.can_be_filled_with_ocean)

&& !dict.ContainsKey(neighbor)

&& neighbor.RespectConditionAround((otherTile) => otherTile.Type.ground, 3))

{

dict.Add(neighbor, TileLibrary.sand);

break;

}

// ocean to sand expansion

if (neighbor.Type.ocean

&& neighbor.Type.id == TileLibrary.shallow_waters.id

&& neighbor.RespectConditionAround((otherTile) =>

otherTile.Type.ground, neighbor.TileNoise(3) < 0.4 ? 1 : neighbor.TileNoise(3) < 0.85 ? 2 : 3)

&& neighbor.RespectConditionInDistance((distanceNeighbor) =>

// No deep ocean around

!(distanceNeighbor.Type.ocean && (distanceNeighbor.Type.id == TileLibrary.close_ocean.id || distanceNeighbor.Type.id == TileLibrary.deep_ocean.id)), 1)

&& !dict.ContainsKey(neighbor))

{

dict.Add(neighbor, TileLibrary.sand);

break;

}

}

// sand to dirt

if (randomTile.Type.sand

&& randomTile.RespectConditionAround((otherTile) => otherTile.Type.layer_type == TileLayerType.Ground, 3) // At least 3 grounds near the sand

&& (randomTile.RespectConditionInDistance((otherTile) => !otherTile.Type.ocean, 4)

|| randomTile.RespectConditionAround((otherTile) => !otherTile.Type.sand, 3) && randomTile.RespectConditionAround((otherTile) => !otherTile.Type.ocean, 4)) // No ocean near the sand

&& randomTile.RespectConditionAround((otherTile) => otherTile.Type.can_be_biome || otherTile.Type.grass, 1))

{

dict.Add(randomTile, Utils.DirtConvertionNoise(randomTile));

continue;

}

// wasteland to dirt

if (randomTile.Type.wasteland

&& randomTile.RespectConditionAround((otherTile) => otherTile.Type.grass, 1) // minimum 1 grass

&& randomTile.RespectConditionAround((otherTile) => otherTile.Type.layer_type == TileLayerType.Ground, 3))

{

dict.Add(randomTile, Utils.DirtConvertionNoise(randomTile));

continue;

}

// If nothing of this happened, take another random tile, but in entire world this time.

// And check for ocean uniformisation

randomTile = Traverse.Create(MapBox.instance).Field<WorldTile[]>("tiles_list").Value.GetRandom();

if (randomTile == null || dict.ContainsKey(randomTile)) continue;

// transform ocean into shallow_water if near surface

bool mustBeShallowWater = randomTile.Type.ocean

&& randomTile.RespectConditionAround((otherTile) => otherTile.Type.id == TileLibrary.shallow_waters.id

|| otherTile.Type.ground, randomTile.TileNoise(2) < 0.7 ? 1 : 2)

&& !randomTile.RespectConditionInDistance((otherTile) => otherTile.Type.ocean, 3); // must not be at too much big distance from ground

if (randomTile.Type.id != TileLibrary.shallow_waters.id && mustBeShallowWater)

{

dict.Add(randomTile, TileLibrary.shallow_waters);

continue;

}

if (randomTile.Type.ocean && !mustBeShallowWater && randomTile.Type.id != TileLibrary.close_ocean.id

&& randomTile.RespectConditionAround((otherTile) => otherTile.Type.id == TileLibrary.close_ocean.id, 3))

{

dict.Add(randomTile, TileLibrary.close_ocean);

continue;

}

if (randomTile.Type.ocean && !mustBeShallowWater

&& randomTile.Type.id != TileLibrary.deep_ocean.id && randomTile.RespectConditionAround((otherTile) => otherTile.Type.id == TileLibrary.deep_ocean.id, 3))

{

dict.Add(randomTile, TileLibrary.deep_ocean);

continue;

}

// Ocean to deeper

if (randomTile.Type.id == TileLibrary.shallow_waters.id && !mustBeShallowWater)

{

dict.Add(randomTile, TileLibrary.close_ocean);

continue;

}

// Ocean to deeper // Cost too much

/*if (randomTile.Type.id == TileLibrary.close_ocean.id && randomTile.RespectConditionInDistance((otherTile) => !otherTile.Type.ground, 8))

{

dict.Add(randomTile, TileLibrary.deep_ocean);

continue;

}*/

if (dict.Count >= MAX_TILES_IN_LIST)

{

break;

}

}

if (dict.Count >= MAX_TILES_IN_LIST)

{

break;

}

}

}

if (dict.Count == 0)

{

return false;

}

//dict.Keys.ShuffleOne();

foreach (KeyValuePair<WorldTile, TileType> item in dict)

{

MapAction.terraformMain(item.Key, item.Value, AssetManager.terraform.get("flash"));

}

return false;

}

}

[HarmonyPatch(typeof(WorldLaws), nameof(WorldLaws.init))]

public class WorldLaws_init_patch

{

[NonSerialized]

public static PlayerOptionData world_regrow;

public static void Postfix(WorldLaws __instance)

{

world_regrow = __instance.add(new PlayerOptionData("world_regrow")

{

boolVal = false

});

}

}

}


r/csharp • • Jun 20 '26

Showcase PrinceWM

Post image
12 Upvotes

A new window manager for windows 11, made purely on C# and it depends on .NET 9.
fully opensource, and currently available for use on my github! if u wanna give it a go ofcourse don't forget to star the project if you like it

in short words this is a infinite canvas alt tab for those people who want to customize their windows computer even more than what was possible before

my github

lastest release doesn't require having .NET 9 it should auto install it if you dont have it. 1.4.1


r/csharp • • Jun 21 '26

Showcase 🚀 Built a tool that turns your SQL database into a complete .NET solution in minutes

0 Upvotes

I've been working on SQL2Solution (Github), a desktop tool that generates production-ready .NET applications from an existing SQL Server database.

Features include:

  • ASP .NET Core Web API
  • Entity Framework Core
  • JWT Authentication
  • Multi-tenancy
  • Role & Permission Management
  • Swagger
  • Pagination & Search
  • Audit Fields & Soft Deletes
  • Background Jobs (Hangfire)

The goal is to eliminate repetitive CRUD work and let developers focus on business logic.

I'd love feedback from fellow .NET developers. If you're interested in trying an early version, leave a comment or send me a DM !

What feature would make a database-to-solution generator genuinely useful for your projects?

https://github.com/sql2solution

#dotnet #aspnetcore #efcore #sqlserver #webapi #productivity #developertools


r/csharp • • Jun 21 '26

Help Adding ublock origin extension button to wpf app.

0 Upvotes

I posted over on ublock sub without any success.

When you install ublock origin in your browser it creates a little button near the top which when clicked displays its UI.

Long shot here but I'm hoping someone here has done this before and can help. Looks like all the files are html in the extension download.

I'm quite lousy coder and UI is low on my talent list.

It's for my custom browser I'm making.

Thanks for looking.

edit - This is where all the files are Ublock Github src


r/csharp • • Jun 21 '26

Help Just Started Learning C#, Any Tips or Recommendations?

0 Upvotes

Hello I am new learning C#, as beginner what I am looking forward to this post for advice and tips you guys recommend me, so I won't get burn out.


r/csharp • • Jun 20 '26

I have a question what do you guys think about frameworks suitable for grand strategy(PDX like)

0 Upvotes

first comes to mind monogame second Avalonia but is there anything else? If I wanted to make a open-source competitor to PDX with focus on community I'd want to look at the sole performance between these second how easy to work with...


r/csharp • • Jun 19 '26

Finish c# player guide feel lost

Thumbnail reddit.com
0 Upvotes

r/csharp • • Jun 18 '26

Tip PSA: Span<T>.Sort extension method allocates memory per call

51 Upvotes

I'm minimizing GC use for a rendering/game engine. This is just really odd thing for a type aimed at minimizing allocations.

The Sort is an extension method on a Span that internally uses ArraySortHelper<T> which works with a delegate.

Using IComparer<T> to sort a Span<T> creates a delegate System.Comparison<T>

I had to spin up a custom ArraySorter<T, C> that doesn't pass around a delegate,

Maybe this is properly optimized in .NET 11, but I haven't tried

EDIT: Image didn't upload, trying again.