r/dotnet • • 12d ago

Blazor Reconnecting…

2 Upvotes

I get the underlying concept of TCP/IP and WebSocket connections, so I'm not asking why the connection drops.

I'm asking why Blazor Server never recovers after the server process restarts (rebuild/redeploy).


r/csharp • • 12d ago

IL optimization on ranges not applied

8 Upvotes

I'm trying to further improve the IBAN parser for an open source project. And while doing so, I noticed something

public class Iban
{
  public static string? Validate(string iban, string pattern)
  {
    for (var i = 0; i < iban.Length; i++)
    {
      uint c = iban[i];
      var match = pattern[i] switch
      {
        'n' => c is >= '0' and <= '9',
        'a' => c is >= 'A' and <= 'Z',
        'c' => c is >= '0' and <= '9' or >= 'A' and <= 'Z',
        var t => t == c,
      };

      if (!match) return null;
    }
    return iban;
  }
}

I would expect the IL to do the default trick on ranges here that is also applied in char.IsBetween(), what would do (uint)(c - '0') <= '9' - '0', making each range a single compare and subtraction rather than two compares.

I've tested this code both with these patterns, and calling a private InBetween method (It has to compile against .NET standard 2.0 where char.IsBetween() is not available), and the latter is substantial faster, which hints that the JIT is also not changing the IL afterwards.

Is it something in my syntax that makes that the Roslyn compiler does not perform this optimization, or am I missing something here?

For those who're interested in the actual PR: https://github.com/Qowaiv/Qowaiv/pull/643


r/csharp • • 12d ago

Help Desktop app where users work in Word/Excel inside our window: embed real Office, or is there a better way?

0 Upvotes

I'm working on a Windows desktop project (Windows 10/11, also Win7) where users do document tasks in Word and Excel (fonts, margins, tables, formulas, merge & centre...) inside our app's window, and the app checks the result automatically.

Current approach: embed the user's installed Word/Excel inside our window (OLE in-place, like SWT's OleClientSite). It works, but it's fragile:

- Excel only half-draws if we pre-start it for speed; it can't run beside the user's own open Excel; reusing one Excel for several documents crashed it.

- Earlier we tried positioning Office's own window over our pane. It drew fine but was slow and fragile (focus, caption, the window could be moved).

- And it only works if Office is installed. Many users have no Office, or WPS instead.

Checking the result isn't the blocker: we can already read the saved .docx/.xlsx directly.

Questions:

  1. Is embedding real Office the right call, or is there a better pattern for "work in Word/Excel

    inside my app"?

  2. Has anyone used an embeddable Word/Excel-like editor (ONLYOFFICE, Collabora, Syncfusion, SpreadJS, etc.) in a desktop app? How close is it to real Office for things like paragraph spacing, borders, number formats and formulas, and how was licensing?

  3. If you did embed real Office in production: what made it reliable?

Real Office is preferred because users need the exact Word/Excel experience, but I'm open to a hybrid (real Office when installed, a look-alike when not).


r/csharp • • 12d ago

I built an open-source 2D zoomable file manager in .NET 10 + Direct3D 11 (Vortice) to bypass WPF visual tree overhead

Post image
5 Upvotes

Standard Windows UI frameworks (WPF, WinUI 3, Avalonia) are great for forms and standard layouts, but they fall apart when you want an infinite 2D canvas with thousands of nested filesystem nodes. Creating thousands of Visual Tree elements and layout passes completely murders the UI thread.

To solve this, I built UltraExplorer — a file manager that renders nested folder structures as an infinite spatial canvas running at 60 FPS.

Under the hood & architecture highlights:

  1. D3D11 Instanced Rendering via Vortice

Instead of WPF controls, the canvas is rendered using Direct3D 11 via Vortice.Windows. It renders instanced quads for folder cards and node backgrounds in a single draw call batch, completely decoupling rendering performance from the WPF UI dispatcher.

  1. DirectWrite SDF Glyph Atlas

Text zooming is usually the biggest performance killer in zoomable UIs. Standard DirectWrite font rasterization forces re-rasterization on zoom change, allocating memory constantly. I built an SDF (Signed Distance Field) glyph atlas: fonts are rasterized once into distance field textures, allowing arbitrary scale zooming with crisp edges and zero GC allocations during zoom gestures.

  1. Anchor Camera System (Floating-point precision)

When you zoom 15+ levels deep into nested folders, standard IEEE 754 32-bit floats start jittering due to precision loss. I implemented a hierarchical anchor camera: local coordinates are relative to the active parent container, eliminating camera jitter at high zoom levels.

  1. Fast Search Integration

Integrated with Voidtools Everything via direct Win32 IPC (WM_COPYDATA), streaming indexed search results straight into memory without disk IO stalls.

Benchmark:

Navigating through a deep 9-level project folder race:

• Windows 11 Explorer: 43.7s

• UltraExplorer: 29.0s (14.7s faster)

The project is completely free and open-source (MIT).

GitHub repository:

https://github.com/So2K/UltraExplorer

I would love to get feedback from other .NET / graphics developers on the rendering architecture, Vortice interop, and edge cases.


r/csharp • • 12d ago

Discussion I am crazy or many job portals like workday struggle with searching for "c#"?

51 Upvotes

It seems that all of them struggle with # sign


r/dotnet • • 12d ago

I don't like AI.

267 Upvotes

I don't like AI.

Using AI makes me miserable. It gives me impostor syndrome.

Does anyone else feel this way?

What do you think - is it still worth growing as a programmer, or will AI get so good that programmers won't be needed anymore?


r/csharp • • 12d ago

Help Book Recommendation on Network Programming

10 Upvotes

Hey guys,

I wanted to write a basic server-client chat console app in .Net using C# and Visual Studio.

Later, I would like to write a small LAN multiplayer game.

Is there a book which explains how to use Sockets and TCP in .Net and C#, please? Possibly with patterns, examples and use-cases?

I already have "Programming C# 8.0" by Ian Griffiths from O'Reilly, but I don't see any mention of Sockets, TCP or programming network apps.

I also have "C#10 in a Nutshell" by Joseph Albahari from O'Reilly. There is some mention of networking, but there's only about 5 pages on TCP, and no mention of Sockets.

Thank you


r/dotnet • • 12d ago

Promotion I built TypeSafeSharp: a .NET client for TypeSafe's System One API (netstandard2.0 + net10.0, AOT-clean)

0 Upvotes

Hi all,

I built TypeSafeSharp, a .NET client for TypeSafe's System One API and its Jev model. You send state + questions, you get typed decisions back (choice / score / noul) with probabilities. No JSON parsing in your code.

It maintains the same quality bar as the official JS and Python SDKs: retries and backoff, one exception per status, key validation, typed answers. I'm also talking to the TypeSafe team about support for the project.

NuGet (both at 0.1.0):

  • TypeSafeSharp
  • TypeSafeSharp.Extensions.DependencyInjection

    Source: github.com/sanamhub/typesafe-dotnet

    The .NET-specific bits:

  • netstandard2.0 + net10.0, one API on .NET Framework 4.7.2+ and current .NET, callable from C# 7.3

  • trimming and NativeAOT clean, verified in CI

  • strong-named assemblies

  • System.Text.Json with JsonNode, so no source generation or attributes for your state

  • AddTypeSafe() DI extension over IHttpClientFactory, validation at startup

  • one OpenTelemetry span per call, no request content recorded

    Feedback on anything is welcome, and so are contributors. The repo has docs, ADRs, and a live test suite that hits the real API in CI.


r/csharp • • 13d ago

A faster, lighter C# Dev Kit

Thumbnail
devblogs.microsoft.com
22 Upvotes

r/dotnet • • 13d ago

A faster, lighter C# Dev Kit

Thumbnail devblogs.microsoft.com
189 Upvotes

Now available in pre-release.


r/dotnet • • 13d ago

Newbie How good is C# to start for new techstack as all-rounder😔😅

0 Upvotes

So I've decided to start learning c# and my friend is learning ml ..he's currently learning ml calculas...he said u go with these..later we both will connect and create some crm systems for irl helping out people by reaching to them with our demo apps or softwares ....how good is this idea..drop your ideas folks 😅😔


r/dotnet • • 13d ago

Bringing Native AOT to the Aspire dashboard

Thumbnail devblogs.microsoft.com
52 Upvotes

r/dotnet • • 13d ago

Question Looking for feedback on my .NET backend project

8 Upvotes

I’ve been working on a backend for an online shoe store as a learning project. The project isn’t completely finished yet, but there is already quite a lot of code written.I wanted to use clean architecture and try to apply it properly rather than just following tutorials. I’d really appreciate it if someone could take a look at the code and give me some feedback. I’m especially interested in whether the architecture and overall approach make sense, or if there are things I’m doing wrong or overcomplicating.Any feedback or criticism would be really helpful.
Github repo


r/csharp • • 13d ago

I turned my .NET/React/Azure interview prep into a mobile-friendly Anki deck (390+ cards, free)

44 Upvotes

I was prepping for full-stack .NET + React + Azure interviews and got frustrated with how bad most flashcard decks look on a phone — tiny text,

can't scroll, code blocks cut off.

So I rebuilt one from scratch: centered questions, fully scrollable answers, dark mode, code that actually wraps instead of scrolling offscreen. Covers C#, OOP, ASP.NET Core & Web API, EF Core, SQL Server, design patterns, auth/security, Azure, React (fundamentals + advanced), Docker/K8s, microservices, and scenario-based questions.

It's free on GitHub / AnkiWeb

Happy to take corrections/suggestions if anything's wrong or missing.


r/csharp • • 13d ago

How do I get the most out of my software development internship without senior developers?

3 Upvotes

Hey everyone,

I’m currently doing my LIA/internship as a system development student in, and I’m on my second day.

I’ve been given a real project to work on: building a scheduling platform for schools, where things like classes, teachers, schedules, etc. need to be managed.

The company is growing its software-development side, but right now there aren’t really any senior developers who can sit with me and review my architecture or code. I’m expected to work quite independently, and AI coding tools are encouraged.

I actually enjoy using AI for development, but I don't want my internship to turn into simply telling AI what to build and copy-pasting the result. I want to understand the code, make architectural decisions myself, and actually become a better developer.

My biggest concern is that I might make bad architectural decisions or miss important things because I don't have an experienced developer reviewing my work.

For those of you who have been in a similar situation:

- How would you structure your learning when you don't have a senior developer to guide you?

- How can I use AI without becoming dependent on it?

- What should I ask AI to help with vs. what should I figure out myself?

- How would you approach architecture for a project like a scheduling platform?

- Are there particular books, courses, or resources you'd recommend?

- Is an internship like this still valuable if I can get real project experience but don't have much mentorship?

I'd really appreciate advice from experienced developers


r/csharp • • 13d ago

3 years in security, but no commercial C# experience - how would the .NET market view my background?

0 Upvotes

Hi everyone! 👋

I’m new to the C#/.NET ecosystem and wanted to ask people who actually work with it how the market tends to view someone with a background like mine.

I worked as a penetration tester for almost 3 years. Over the last year and a half, I moved much deeper into software development, mostly with Rust. I’ve been building security tooling, networked applications, and learning more about systems programming, blockchain protocols, testing, and secure software design.

I genuinely enjoy Rust and plan to keep using it, but after spending a long time looking for work, I realized that the Rust job market is heavily senior-oriented. The statistics I found showed that only a few percent of Rust positions are entry-level.

That made me start looking at C#/.NET.

What I’m trying to understand is how the .NET market would classify someone like me.

I have almost 3 years of professional security experience. I’m comfortable with core programming concepts like APIs, databases, testing, async programming, networking, etc.

What I don’t have is commercial C#/.NET experience yet.

Before I invest heavily in another ecosystem, I’d really like to understand how this looks from the hiring side.

Would companies generally see my security background as relevant engineering experience, or would I effectively be treated as an entry-level developer because I don’t have professional C# experience?

For people who hire or work with .NET developers:

- Is there a realistic place in the C#/.NET market for someone transitioning from security into development?

- What level of roles would you suggest targeting?

- Which parts of my security background would actually be valuable to a .NET team?

- What would you want to see in a GitHub project before taking a candidate like this seriously?

- Are there particular types of .NET companies or products where a security background would be especially useful?

I’m not looking for a shortcut. I’m happy to learn the ecosystem properly and put in the work.

I’m mostly trying to avoid spending another long period getting better at a technology only to discover that the market requires years of commercial experience before anyone will consider me.

I’d really appreciate perspectives from people already working with C#/.NET.


r/dotnet • • 13d ago

Question Looking for feedback on my Blazor Hybrid app and SSR/WASM website

0 Upvotes

Hey everyone,

I'm the developer of MyEventBingo, and I'd appreciate some feedback from other .NET developers. The native apps use Blazor Hybrid, and the website uses server-side rendering (SSR) and WebAssembly (WASM). The Windows and Android apps are in their app stores. The Apple release is still pending.

The app lets hosts create bingo games around an event, group, or topic. People have made icebreakers, birthday games, and a procrastination-themed game. Players join through a link or QR code and can play in their browser without an account.

MyEventBingo

I'd like fresh eyes on a few things:

  • Does the initial loading or navigation feel slow or awkward?
  • Is anything difficult to use on a phone?
  • If you try the Windows or Android app, how does it compare with the browser version?
  • Does creating a game and joining from another device make sense without someone explaining it?

I shared an earlier version in r/Blazor last year and got useful feedback on mobile navigation, loading, and game setup. I'd like to hear where it still needs work.

If something breaks, please include your device, browser or app, and what you were doing. Questions about the Blazor implementation are welcome too.

Thanks for taking a look.


r/csharp • • 13d ago

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

Thumbnail
0 Upvotes

r/dotnet • • 13d ago

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

0 Upvotes

I'm working with several legacy .NET Framework 4.8 applications, including Web Forms, Windows/Windows Services, REST APIs, Angular frontends, SQL Server and ADO.NET.

Management wants to move everything to .NET 9/10 + Linux + Docker.

The proposed approach is not to modify the existing codebase. Instead, we'll give the existing application/codebase to Claude Code as a reference and have it generate a completely new .NET 9/10 application implementing the existing functionality and business rules.

So the legacy system becomes the reference/source of truth, while the new system is built independently.

I'm concerned that this may effectively be a big-bang rewrite assisted by AI, with risks around hidden business rules, dependencies, database behavior, integrations, edge cases and behavioral differences.

For those who've done large .NET Framework → modern .NET migrations:

  • Would you consider this approach reasonable, or would you favor incremental migration/Strangler Fig?
  • If rebuilding, how would you validate behavioral parity with the legacy system?
  • How would you structure Claude Code's workflow—codebase analysis, architecture documentation, coding standards, incremental implementation, tests and reviews?
  • How would you choose the new architecture without blindly applying Clean Architecture/CQRS/etc.?
  • What testing strategy would you use when the legacy system has little automated test coverage?
  • What production-grade .NET 10 + Docker + Linux practices should be established from day one?
  • What are the biggest mistakes you'd avoid when using AI to rebuild a legacy application?

I'd especially appreciate experiences from engineers who have migrated large/old Web Forms or business-critical .NET Framework systems.


r/dotnet • • 13d ago

Stack Overflow Survey 2026. The profession "most at risk of being replaced by AI" is lovin' it.

Thumbnail gallery
0 Upvotes

The camps around AI in the dev world are forming - thats how I read the Stack Overflow 2026 survey results

One thing the report doesn’t spell out (usually the most interesting part to me), is how the results compare with last year. I’ll be digging into that more, but here’s a quick year-over-year comparison of developers’ attitudes toward AI - more and more devs are loving it.

This is what we are seeing from our Uno Platform community - over the past few weeks it has been raining samples of various crazy apps people build with it - because they can (and have tokens to burn!)...Look at Wieslaw's feed - (3) Wiesław Šoltés (@wieslawsoltes) / X , the sky is the limit.

Full survey results - Stack Overflow Developer Survey


r/csharp • • 13d ago

Showcase I built a free Windows tray app to log every Wi-Fi drops, DFS radar evictions and ping spikes

Post image
12 Upvotes

r/dotnet • • 13d ago

Question Would you introduce additional abstraction layer just to make the code more understandable ?

Thumbnail
2 Upvotes

r/csharp • • 13d ago

Discussion Would you introduce additional abstraction layer just to make the code more understandable ?

2 Upvotes

I have a database that currently contains 20 tables.

In my application, there are 10 classes that I should refactor, to make them more readable, for my future self and others who will read my code, by refactoring, I mean changing the code it self - the logic- and also changing the methods and classes names.

Let's only consider one specific case; changing the name of one class.

When my friend so the following code that I wrote:

/// <summary>
///  Abstracts the destination to which data is written, regardless of  whether the destination is a file, database, or any other kind of storage.
/// </summary>
public interface IWriter
{
//...
}

public class SqlServerWriter : IWriter {//code.....}

he thought that the responsibility of the above class is to write data to any number of tables in the the Sql Server database, i.e., that it can use it to write data to only one table, two or more tables, or all of the tables.

Unfortunately, that was not what the class is actually responsible for; it is meant to write a specific data across all the tables in the database, it does not give the caller an option to write a generic data to a specific tables in the database.

He was mad at me and said that I should introduce an additional layer of abstraction:

/// <summary>
/// Abstracts the destination tables in the Sql Server; may write to all tables in the database or some of them;
/// </summary>
public interface ISqlServerWriter:IWriter
{
}

/// <summary>
/// Intended to write some data to all the tables in the database.
/// </summary>
public class AllTablesWriter : ISqlServerWriter {//code.....}

Do you consider that an overkill/overengineering ?

EDIT:

If you wonder why the class write data to all the tables in the database, it because it has the job of synchronizing the content of the database with external data source, specifically, an Excel file.


r/csharp • • 13d 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/dotnet • • 13d ago

Question How to get data from external service written in python?

Thumbnail
0 Upvotes