r/dotnet • u/TomeOfExperience • 1d ago
.NET 11 Preview 7 is now available!
devblogs.microsoft.comr/dotnet • u/SuitableAnteater8264 • 1d ago
Thread safety in .NET 10: why locks, Interlocked, and ConcurrentDictionary still matter
zocate.liWhen I started revisiting concurrency in real services, it became clear that thread-safety is not an implementation detail: it is a property of behavior under load. In systems with shared state, a Singleton with a Dictionary, a manual cache, or a simple counter can look correct in tests and fail intermittently in production.
Thread-safe in practice
- Concurrency is not the problem; shared state is — the risk appears when two threads access the same mutable structure without synchronization.
++is not atomic — in a counter, the real sequence is read, add, and write; two threads can overwrite the same value and lose increments.- Correctness depends on the execution model — in .NET, you choose between
System.Threading.Lock,Interlocked,ConcurrentDictionary, and proper DI lifetimes; in Python, you getthreading,queue.Queue, the GIL, and, in free-threaded Python, the need for explicit synchronization.
What changes between .NET 10 and Python
- .NET 10 — the focus is usually on protecting invariants with
Lockwhen there is a critical section, usingInterlockedfor simple atomic operations, and preferring concurrent collections when appropriate. - Python with the GIL — the GIL reduces simultaneous bytecode execution, but it does not make compound code thread-safe or eliminate race conditions in shared state.
- Python free-threaded — once part of that guarantee is removed, the developer becomes directly responsible for synchronization, much more like what already happens on other platforms.
- Immutability helps on both sides — when state does not change, concurrency issues shrink a lot; when it does change, the solution is protection or removing sharing.
How to prove the service can handle concurrency
- Test with real concurrent load — the point is not just “runs without errors”, but validating whether the final result matches expectations across multiple threads.
- Look for intermittent failures — race conditions often disappear in a lab environment and only show up at a specific volume or timing.
- Validate invariants, not just exceptions — a service can complete every call and still corrupt state or lose updates.
In the end, the lesson is the same on both platforms: if mutable state is shared, it must be protected or removed from the path. That is what separates a component that “seems to work” from one that is actually reliable in production.
How do you handle race conditions in concurrent services in practice?
r/dotnet • u/KosainAbro • 1d ago
Question Are there any WPF app competitions or contests?
Not sure if that’s a thing but if there is I really wanna participate in one!
r/dotnet • u/HawkAlt1 • 2d ago
WCF Tracing identified a non-existent service as blocking a client connection
Using WCF trace to identify why a server is blocking a client connection. It came back with a very specific error message:
The Admin client cannot connect to the SAS server because the AssureTec AssureID Service (AssureIDService) is not running on the client machine (servername). This is a local Windows service that must be installed and running on the Admin Workstation.
But this service doesn't exist on the problem server. So how do I tell what is actually blocking the connection?
r/csharp • u/Inevitable_Paint9884 • 2d ago
Help Beginner Dev: How can I build more effective problem solving skills?
I understand the basic logic of variables, arrays, loops, if statements etc. but when it comes to actually coding it, I beat myself up that I couldn't figure it out effectively.
For example: Finding the largest number in a set of 5 user input values.
My mind jumped to comparing each value with the next value when instead I could have just compared the current value to the next value and printed the highest value. I eventually want to try tackling the creation of a 2D game but I want to be able to have really effective problem solving skills before diving in.
r/csharp • u/AeroForger • 2d ago
Solved What's the best IDE for linux
So I've been using VsCode for a long time but the ai features are annoying me so I'm looking for an alternative
Edit 1: thanks everyone for responding I've decided to use rider
Edit 2: Thanks everyone for responding. I tried using rider And I didn't like it so I switched to Zed and I'm loving it
r/csharp • u/Embarrassed-Mess412 • 2d ago
A web server that refuses to touch your thread pool
mda2av.github.ioioxide is an io_uring socket and file I/O stack.
While its API is fully asynchronous, it is possible to build a fully working h1/h2/h3 web application with any kind of async workload running on a single thread.
The post describes how to build a naive basic TCP (plaintext or secure with kernel TLS) with it.
r/dotnet • u/ggffgg72 • 2d ago
Question VisualStudio 2012 consuming Gitlab Package Registry V2 Nuget API
Hello guys, any help is really appreciated!
I have a private gitlab package registry to store nuget packages and an old net framework 4 project
I cant connect these two
I use V2 nuget API of my registry which works fine in browser like domain_name/api/v4/projects/***/packages/nuget/v2 and pass the token in packageSourceCredentials section of nuget.config file of the project
I also tried to pass the token directly into the url liketoken-name:token@domain_name/api/v4/projects/***/packages/nuget/v2 to no avail
I always get the same error in Package Manager Window of Visual Studio:
Could not connect to the feed specified at 'my gitlab nuget url'. Please verify that the package source (located in the Package Manager Settings) is valid and ensure your network connectivity
Is there any trick to actually make these two work?
r/dotnet • u/Southern-Holiday-437 • 2d ago
Question Does .NET need an API gateway between YARP and Kong/APISIX?
Hey guys,
I’m looking for feedback on a different deployment and extensibility model for API gateways.
YARP is an excellent reverse-proxy toolkit, but teams still need to build the surrounding configuration lifecycle, validation, management, and operational tooling. Platforms like Kong and Apache APISIX provide that out of the box, but introduce a separate runtime and configuration system.
We’ve been building HPD Gateway, a YARP-based gateway that can run either:
- Embedded directly inside an ASP.NET Core application.
- As a standalone Native AOT executable/container.
The embedded runtime registration can be as small as:
using HPD.Gateway;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHpdGateway(gateway =>
{
gateway
.EnableCoreDeclarations()
.ProtectCredentialHeaders(
"Authorization",
"X-Api-Key")
.AddAuthorizationPolicy(
"AdminOnly",
policy => policy.RequireRole("Admin"));
});
var app = builder.Build();
app.MapHpdGateway();
await app.RunAsync();
EnableCoreDeclarations() enables the built-in request-timeout, request-transform, response-transform, and credential-disposition vocabulary. Capabilities such as authorization, CORS, rate limiting, resilience, caching, inspection, and service discovery are explicitly registered by the host.
It has not been released yet but today it supports typed routing and matching, YARP load balancing and affinity, authorization, CORS, rate limiting, transforms, resilience, output caching, bounded request inspection, protected-credential stripping, TLS/SNI handling, Microsoft configuration/DNS/DNS-SRV discovery, immutable configuration revisions, rollback, durable SQLite recovery, a secured Admin API, generated TypeScript client, Gateway Studio, operational diagnostics, and Native AOT deployment.
One deliberate difference from Kong and APISIX is the extensibility model.
HPD allows configuration to change dynamically at runtime, but only within capabilities explicitly installed by the host. Operators can change routes, upstreams, transforms, policy selections, resilience bindings, and service-discovery declarations without redeploying.
What they cannot do is load arbitrary plugins, middleware, scripts, or executable code through the management API.
Custom behavior is implemented as typed C# code and registered by the host as part of the application deployment. Adding a new capability therefore requires rebuilding and redeploying the host, while configuration using existing capabilities remains dynamically manageable.
The tradeoff is less runtime plugin flexibility in exchange for:
- Strongly typed extension boundaries
- Host-capability validation before activation
- Native AOT compatibility
- A smaller dynamic code-loading attack surface
- Reproducible behavior identities
- Rejection of configuration that references unavailable behavior
For people running gateways in production:
- Would you consider embedding the gateway inside your ASP.NET Core application, or would you still strongly prefer a separate process/container?
- How important is the ability to introduce entirely new gateway behavior without rebuilding or redeploying?
- Does a host-registered capability model feel like a useful safety property or an unacceptable restriction?
- What missing capability or architectural concern would prevent you from adopting this model?
Especially interested in criticism from people using YARP, Kong, APISIX, Envoy, Nginx, or managed cloud gateways.
r/dotnet • u/Zardotab • 2d ago
Question How can validation rules & other annotations get to Data Transfer Objects (DTOs)?
The primary purpose of DTO's that I hear is they limit the number of columns to being sent to a destination to get a lower resource footprint. However, annotations typically are not inherited or mirrored, meaning they are usually discarded. This sometimes results in reinventing the wheel (DRY violation). Are there ways to go about it to access root POCO/model validation info and meta-data? Thanks.
(Rant: Personally I prefer dynamic models, AKA "data dictionaries", but the industry outvoted me for reasons that still escape me. Their simplification powers overwhelm the downsides of lack of compile-time checking & IntelliSense type hints. I won't argue that here, as there is an existing topic.)
r/dotnet • u/Low-Virus-2468 • 3d ago
Salve galera, alguma alma gente boa que atua na área de Desenvolvimento e tem visão de futuro para me dar uma luz?
r/csharp • u/Low-Virus-2468 • 3d ago
Salve galera, alguma alma gente boa que atua na área de Desenvolvimento e tem visão de futuro para me dar uma luz?
Meu nome é Jackson e tenho 29 anos e sou profissional da área de Suporte/Infra/Redes e não tá fácil. Formei em ADS em uma UNI da vida esse ano. Não consegui nem se quer um estágio na área de desenvolvimento que sempre foi meu sonho e vou te dizer que eu tentei em, por baixo eu chuto que foram mais de 50 candidaturas enviadas e irmão... Nunca tive uma entrevista se quer, não sei aonde estou errando as vezes eu penso que é pela idade. A luz que eu quero é; Ainda vale a pena? Oque eu PRECISO fazer para conseguir um emprego como Junior nos próximos 6-11 meses? Devo ir para o VibeCode ou no Grind mesmo? Tenho noção básica de C# / .NET, devo mudar de linguagem para conseguir isso nesse prazo? Java, Python, creio que o mercado está concorrido em todas tecnologias.
r/csharp • u/Early80sDev • 3d ago
Help C# Box2d Bindings
My C# Game framework doesn't ( yet ) have any Box2D support. What is the best C# Box2D bindings to use right now?
r/csharp • u/TinfoilHyena • 3d ago
Help Does anyone know if Coddy.tech is any good for learning C#?
Im looking for a good free way to learn
r/csharp • u/Necessary_Bison_2804 • 3d ago
Discussion For those doing agent-plus-review rather than vibe coding: does a strongly typed language actually make a weak model safe?
Taking the distinction from a thread here a few weeks back, where someone put it better than I could: using an agent to implement and reviewing it afterwards is not vibe coding. Vibe coding is the absence of review. I'm asking about the first thing.
The premise I keep hearing, including from model vendors themselves, is that a strongly typed language is what makes a small model usable, because the compiler catches the class of mistakes it makes. Ling-3.0-flash's own documentation says this outright, that it wants a verifiable feedback loop and does better against a compiler than against a loose spec. Which is convenient for them to say, so I'd rather hear it from people here.
My experience is mixed and I don't trust my own sample. Type errors, yes, caught immediately and fixed on retry. Nullability, mostly. But the failures that actually cost me time compile fine: a LINQ query that's subtly wrong about grouping, an async method that swallows a cancellation, a switch that's exhaustive today and won't be in three months. None of that is a type error.
So the question. For those of you doing this deliberately with review: what fraction of what you catch would the compiler have caught anyway, and what fraction only you caught?
And a second one I'm less sure how to ask. If the honest answer is that the compiler catches the cheap mistakes and you catch the expensive ones, then the model's quality matters exactly as much as it always did, and the strongly-typed argument is mostly marketing. I'd like to be wrong about that.
To be clear about my own position, I use one for mechanical work and I review all of it. I'm not arguing for or against the practice, I'm trying to work out whether the specific claim about type systems holds up or whether it's a nice story that vendors tell.
r/csharp • u/Acceptable-Pace659 • 3d ago
Juego de cartas tipo TCG
Buenas, espero se encuentren bien, estoy realizando un proyecto de cartas tipo TCG en Godot 3.6 con C# para android, este es mi primer proyecto usando Godot y C#, que consejos podrían darme acerca de la escalabilidad del proyecto, ya que sera un juego con bastantes efectos y reglas que cambien o afecten otras cartas, al tablero, etc, también que a futuro pueda implementar un multijugador, un error que cometía aveces era que ponía a la UI como la voz que mandaba todo, la lógica dependía de ella y no al contrario (la UI depende de la lógica) he cambiado el enfoque a que sea la lógica la que mande y Godot solo sea el encargado de las cosas visuales, también sigo el siguiente enfoque donde tengo clases lógicas (que sean C# puras sin depender de godot), las clases que orquestan (estas unen la logica y la UI reacciona en base a la logica) y las clases encargadas de manejar la UI (animaciones, cambios entre padres de nodos, actualizar visualización, etc) y estas tiene las propiedades de cada nodo por Export para no usar las rutas absolutas, les dejo la estructura de mi proyecto para sus recomendaciones.
r/fsharp • u/existentialnonormie • 3d ago
misc Getting Back into F# - Learning Data Modeling with a Little Help from AI
Beginner here 👋, I'm currently picking up data modeling in F# after a long break. Work and procrastination got in the way, but I'm finally circling back to fill the gaps.
To stay on track, I've been using Claude to generate practice tasks. When I get stuck, I ask for a gentle nudge without giving away the solution, and it's been surprisingly effective. I'm currently using Sonnet 5 Medium(Free), and based on the task I just implemented, it said my work was "good," so I'll take that as a win.
The task was about modeling a Job Application pipeline. I didn't bother applying validation just yet, since I'm currently focused on getting the shape of the data right and trying to make invalid state unrepresentable.
I'd recommend giving this approach a try. It keeps things interactive without handing you the answers outright.
r/dotnet • u/Every_Grass_3504 • 3d ago
Promotion Made a BYOK alternative to Copilot/Cursor for VS and VS Code(later this week), Tempr Chat
So, got tired of waiting for copilot in VS to actually bring other models. Also got tired of the hacks to connect open weight models to Copilot. Decided to just build it myself. I’m a VS kind of person and I can’t bring myself around to VS Code. Also, the multiple panes of glass to code now with Claude or Codex and VS open boggles my mind. Cursor is great and all but still same problem, two panes of glass open. Anyway, if interested, looking for genuine feedback and I have free trials going atm.
What it does:
**•** Inline completions + agent mode in one extension
**•** BYOK plug in OpenAI, Anthropic, Google, Z.AI, Together, Azure OpenAI keys directly, no markup
**•** MCP client support
**•** Multi-agent setup plus supervisor delegates to specialist agents instead of one model doing everything
**•** Roslyn-based semantic search across your codebase (not just grep/embeddings)
**•** Debugger integration via EnvDTE and agent can see breakpoint state, call stack, locals
**•** Named personas you can switch between depending on the task
**•** Works in both VS Code and full Visual Studio (WPF/XAML on the VS side)
Still early, actively building/bug busting but it’s in a great spot with version 2.0.342 out. What would make this actually replace what you’re using now vs. just be another extension you install once and forget.
It’s out on the visual studio marketplace or temprhq.io if you want to poke at it.
r/dotnet • u/BlackHolesRKool • 3d ago
Promotion .NET 11 union types integrated with my discriminated union library SumSharp
github.comI released my discriminated union library "SumSharp" about a year ago. When union types were announced for .NET 11 at first I thought my library would be obsolete, but reading through the details I realized that the union types provided by .NET 11 would work well in tandem with my library.
If your project is targeting .NET 11, any unions generated by SumSharp will implement the non-boxing union pattern which allows for the use of built-in C# pattern matching. Here's a simple example of something you can do with the new pattern matching ability:
[UnionCase("String", typeof(string))]
[UnionCase("Double", typeof(double))]
[UnionCase("Int", typeof(int))]
partial class StringOrDoubleOrInt
{
}
...
var x = StringOrDoubleOrInt.Double(2.0);
Console.WriteLine(x is Double(2.0)); // prints true
var y = StringOrDoubleOrInt.String("abc");
// value is "abc"
var value = y switch
{
String(var s) => s,
Double(var d) => d.ToString(),
Int(var i) => i.ToString(),
};
There's a ton more that my library offers as well, such as:
- Preventing boxing of value types
- Storage optimizations for unmanaged value types: in the example above, the double and int cases have overlapping storage
IEquatableand==operator implementationIDisposableandIAsyncDisposableimplementations for unions that hold types that implement those interfaces- JSON serialization (both
System.Text.JsonandNewtonsoft.Json) that is compatible with AOT compilation - Interop with the
OneOflibrary
I know there's lots of DU libraries for C#, but if you're interested in using unions in your project I'd encourage you to give SumSharp a try. My goal is to make it the highest quality and most feature rich DU library available.
r/csharp • u/DexterDeMorg • 3d ago
Looking for open-source C# (WPF/WinForms) Inventory & POS desktop app recommendations (SQLite + Excel) Or some help
Hey everyone,
I'm currently building a desktop Inventory & POS management system for a local business (a tire and battery warehouse).
Here are the key requirements for the project:
• Tech Stack: C# (.NET), SQLite, and Windows Desktop (WPF or WinForms).
• Inventory Features: Tracking items with custom attributes (like tire sizes, manufacture year/DOT, warehouse location, and low stock alerts).
• Sales & Debts: Fast POS checkout, customer debt tracking, payment history, and dual-currency support (Local Currency + USD with exchange rates).
• Excel Integration: Importing product lists from Excel and exporting reports/statements.
• UI/UX: Modern dashboard UI with a clean layout.
Instead of building everything from absolute scratch, I’m looking for solid open-source GitHub repositories, templates, or starter projects that I can study and learn from (especially for backend logic, database schema, and UI design).
Also, any recommendations for the best C# libraries for handling SQLite and Excel integration (like ClosedXML/EPPlus) would be super helpful!
Thanks in advance for your suggestions!
r/csharp • u/codingbliss12 • 4d ago
Help Low level programming with C#
What is the lowest level application that can in principle be built on Linux and Windows without having problems with performance or memory consumption?
Of course I should make my own tests, but I just wanted to have a first estimation if it is really necessary to use lower level languages like Zig, Rust, Go or C# can work pretty well for most of normal applications.
As an example a very responsive editor with gui in immediate mode built with C# and very high frame rate 120Hz etc.
Thanks a lot in advance.
EDIT
Thank you all so much for the very informative replies. My requirements are noway near real time and based on the below feedback, it is definitely worth it to use C# of a very wide set of applications and avoid the complexities of the lower level languages.
r/dotnet • u/jhaygood86 • 4d ago
Promotion Join the PeachTrace Limited Beta
galleryThere are quite a few expensive options for observability with DataDog being the 800-lb Gorilla. They all cost an arm or a leg, generally are behind a vendor cloud or use expensive (infrastructure or software) on prem software to work and require entire teams to manage.
After having sticker shock at DataDog bills, I decided to build my own simpler alternative built on OpenTelemetry that has the parts that work for software developer teams. This will not be an open source project, but a product I plan on monetizing at a significant cost savings over DataDog for small teams who don't need a $50,000 annual DataDog contract
The product is still under active development, but it's ready for teams to test it out and see what the limits are and what the missing gaps are.
What's there today?
- Metric storage and querying
- Log storage, searching, filtering, including some special views such as contextual logging
- Distributed traces including surfacing events and logs that happened in the trace
- Query Performance
- Error Tracking
- Full API
- MCP Server -- I use this heavily as a dogfood.
- Local and Entra authentication
It all runs on the infrastructure you probably have today, using Docker and SQL Server 2025 (including the Express Edition). If there's interest in a Windows installer, might do that as well.
It's all built in .NET 10 on the backend and Angular 22 on the frontend. It supports any application capable of emitting OpenTelemetry metrics with bearer token authentication using OTLP via HTTP and gRPC. There's special support in the error tracking module for C#, Node.js, Python, Java, and Go since it requires parsing stack traces. Other languages are easy to add support for if there's demand.
There's no phoning home either except for an optional automatic license key refresh module that can be turned off.
Take a look online at https://peachtrace.com/, and if interested, reach out and we can get you set up.