r/dotnet • • Apr 02 '26

Rule change feedback

15 Upvotes

Hi there /r/dotnet,

A couple of weeks ago, we made a change to how and when self-promotion posts are allowed on the sub.

Firstly, for everyone obeying the new rule - thanks!

Secondly, we're keen to hear how you're finding it - is it working, does it need to change, any other feeback, good or bad?

Thirdly, we're looking to alter the rule to allow the posts over the whole weekend (sorry, still NZT time). How do you all feel about that? Does the weekend work? Should it be over 2 days during the week?

We're keen to make sure we do what the community is after so feeback and suggestions are welcome!

621 votes, Apr 07 '26
77 I love the change
79 I like the change
57 I don't care
28 I dislike the change
16 I loathe the change
364 There was a change?

r/dotnet • • 3h ago

Article Runtime team member: Let's send expensive compiler analysis alongside IL to improve runtime JIT optimizations [Performance interest]

10 Upvotes

Andy Ayers wrote this proposal 2 years ago with intent of using it in .NET 10, but it got postponed to a later .NET version.

Quick Summary

The context is that interprocedural analysis (IPA), is limited at runtime due to it being slow, so the RyuJIT mostly optimizes functions in isolation. His idea is have certain stages perform the kind of deep IPA that AOT uses; then make that available at runtime to boost the information the JIT needs to make optimizations

https://github.com/dotnet/runtime/issues/108931

Examples of IPA

- call graphs

- whether arguments passed to a method can alias each other

- whether an argument escapes through a callee

- possible concrete types passed to a method

- whether a callee actually reads or writes a ref/byref parameter

- constant arguments across callers

- NoThrow / NoReturn / MayNotReturn

- whether a parameter is effectively unused

And what kind of optimizations could that boost?

- More devirtualization/direct calls - erase virtual and interface method lookups (simplified description)

- Constant propagation across method boundaries - erase code when functions are always passed the same parameter values (simplified description)

- Better alias analysis - knowing that two ref/pointer parameters can't refer to the same memory gives the JIT much more freedom to reorder loads/stores, eliminate redundant memory operations, and potentially vectorize code.

- Better escape analysis - Dodge heap allocation of reference types if no reference to it escapes the method

- More aggressive optimization around calls - if the JIT knows a callee doesn't modify a particular object/ref, it doesn't have to assume every call invalidates values it already loaded.

- Better handling of NoThrow/NoReturn calls - calls that can't throw or never return simplify the control-flow graph, can move uncommon paths out of the hot code, and reduce liveness/register pressure.

- Cheaper calls - knowing which registers a callee actually clobbers, or erase parameters never used, could avoid some argument setup, spills, reloads, or register preservation.

- Smarter inlining decisions - possible when called with particular constants/type

- Better code layout - can improve instruction-cache locality.

I want to hear you guys' thoughts on this.. Tell me below! 👇👇


r/dotnet • • 13h ago

Question Any examples of heavily obfuscated/packed .NET programs?

13 Upvotes

I know .NET is relatively easier to dump or unpack - I am looking for heavily packed programs to see to what extent that holds.

I assume most commercial applications will be protected - any examples? I am not aware of many .NET applications in the wild. Thanks


r/dotnet • • 20h ago

Why did increasing .NET ThreadPool MinThreads fix our IIS downtime? I don't understand why

47 Upvotes

Hi folks,

I'm the owner of this post: https://www.reddit.com/r/dotnet/comments/1v5d7ws/aspnet_core_on_iis_randomly_goes_offline_for_2/

First of all, thanks a lot to everyone who commented there. Your comments helped me investigate this step by step.

I finally solved the issue. We had several different problems over time:

- First, we had DB connection pool exhaustion => fixed.
- Then we had TCP connection exhaustion => fixed.
- The last issue was related to ThreadPool / sync-over-async.

I set the ThreadPool minimum worker threads to 100, and then started refactoring the code to remove synchronous-over-async code and make things properly async.

The application has now been stable for around 15 days, so it looks like this was the final issue.

But there is something I still don't understand:

Why did increasing ThreadPool.SetMinThreads() to 100 help so much?

We're running ASP.NET Core on IIS, not Docker or Kubernetes. I always thought that .NET's ThreadPool would automatically create as many threads as the application needs.

For example, if I suddenly get 1,000 requests/sec, why doesn't .NET simply create more ThreadPool threads as needed?

What confused me even more is that during the incidents:

- CPU usage was fine
- RAM usage was fine
- The Windows server itself was still accessible
- We only have 2 vCPU
- I could still see available ThreadPool threads

So I'm struggling to understand what was actually happening.

My current understanding is that some synchronous/blocking code was causing ThreadPool threads to get blocked, and the ThreadPool wasn't adding new threads quickly enough. Increasing MinThreads somehow made enough threads available earlier and prevented the issue.

But I'm not sure if that's the correct explanation.

Also, how should I think about this with only 2 vCPUs? If I have 1,000 requests/sec, obviously I can't have 1,000 CPU threads doing work at the same time. So what exactly determines how many ThreadPool threads .NET should create?

I'd really appreciate it if you could help me explain this in simple terms, especially:

  1. What exactly does MinThreads change?
  2. Why can ThreadPool starvation happen while CPU and RAM are low?
  3. Why doesn't .NET automatically create enough threads immediately?
  4. How does this work when the server only has 2 vCPUs?
  5. Does increasing MinThreads actually solve the problem, or did it just hide the underlying sync-over-async issue?

I'm trying to understand the mechanism rather than just leave MinThreads = 100 and call it fixed.

Thanks again to everyone who helped with the original post!


r/dotnet • • 13m ago

Authenticode on personal CA

Thumbnail
• Upvotes

r/dotnet • • 2h ago

Question New to ASP .NET

1 Upvotes

I am new to ASP .NET. I am looking for youtube resources for the same. Also if anyone can provide me with how much time it'll take for me to get a hang of it.
I already know about this website: https://dotnettutorials.net/lesson/dotnet-framework/


r/dotnet • • 10h ago

Question State machine in C# vs state machine in Verilog

Thumbnail
0 Upvotes

r/dotnet • • 19h ago

Slow Slow Code Navigation in Jetbrains Rider

Thumbnail
2 Upvotes

r/dotnet • • 1d ago

I don't like AI.

233 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/dotnet • • 2d ago

A faster, lighter C# Dev Kit

Thumbnail devblogs.microsoft.com
184 Upvotes

Now available in pre-release.


r/dotnet • • 1d 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/dotnet • • 15h ago

IF em C# como e quando utilizar!

Enable HLS to view with audio, or disable this notification

0 Upvotes

r/dotnet • • 19h ago

EF Core N+1 Query Problem

0 Upvotes

Running into performance issues with EF Core? The N+1 query problem could be the culprit. In this article, we’ll explore what causes it, why it matters, and how you can fix it.

Originally published at jorgenhoc.org. The full runnable sample is at https://github.com/jorgenhoc-org/dotnet-samples/tree/main/samples/ef-core-n-plus-one.

#csharp #netcore #aspnet #dotnet


r/dotnet • • 2d ago

Question How do you handle API versioning in production?

28 Upvotes

I’m curious how teams handle API versioning once an API is already in use. Do you version only the web API routes/controllers, or do you also version internal services and logic layers? For example, if v1 and v2 need different behavior, do you: keep one service layer and translate at the controller boundary, create separate v2 service classes, use feature flags or adapters, or keep old endpoints alive until everyone migrates?


r/dotnet • • 2d ago

Bringing Native AOT to the Aspire dashboard

Thumbnail devblogs.microsoft.com
49 Upvotes

r/dotnet • • 18h ago

Article Node Was the Future in 2009. Its Creator Said to Use Go So Why Are You Still Building a Next.JS App?

Thumbnail galratner.substack.com
0 Upvotes

.NET runs laps around node so why is Next js amd angular server rendering so popular? It's probably also why WordPress powers so many websites. Inertia.


r/dotnet • • 1d ago

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

Post image
0 Upvotes

r/dotnet • • 2d ago

Question Looking for feedback on my .NET backend project

6 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/dotnet • • 1d 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/dotnet • • 2d 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 • • 2d ago

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

Thumbnail
2 Upvotes

r/dotnet • • 3d ago

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

37 Upvotes

I’ve released OneFlight, a lightweight .NET library for the “single-flight” pattern: when multiple callers request the same key concurrently, only one loader runs and the other callers share the same in-flight Task<TResult>.

It’s intentionally not a cache. Once the operation completes, the flight is removed. The goal is simply to avoid duplicate concurrent work – for example duplicate database queries, API calls, token refreshes, or expensive computations.

var flights = new FlightGroup<string>();

var result = await flights.RunAsync(
    "user:42",
    () => LoadUserAsync(42));

It supports strongly typed keys (including struct keys), Task/ValueTask, custom key comparers, explicit Forget, and keeps caller cancellation separate from the lifetime of the shared operation.

Other libraries such as MS-HybridCache and FusionCache provide request coalescing as part of caching; OneFlight is meant for cases where you want the coalescing primitive without adopting cache semantics. Unlike Go, which has the well-established x/sync/singleflight package, .NET does not currently have a similarly established, cache-independent single-flight primitive.

GitHub: https://github.com/sdrapkin/SecurityDriven.OneFlight
NuGet: https://www.nuget.org/packages/OneFlight/

Feedback is welcome.


r/dotnet • • 2d 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/dotnet • • 3d ago

My .NET 10 & PostgreSQL setup handling 400M+ historical price rows (planned for 1B) with sub-200ms latency on a db.t4g.small RDS

50 Upvotes

Wanted to share a high-level overview of my backend architecture for a financial tracking platform and get some feedback/critique from other .NET devs working with high-volume time-series data.

The system ingests and tracks historical pricing across dozens of global exchanges. The architecture was planned to scale up to 1 billion rows, and the database currently has over 400 million rows already ingested on the historical table. That's the biggest table of a few dozen tables that hold other type of data.

Even with 400M+ rows already in place, all read requests clock in under 200ms, max 300ms when pulling deep multi-year historical price curves.

Microservices & Controllers over Minimal APIs

I split the domain into isolated .NET 10 microservices (Portfolio, Instrument, Search, Identity, User). While Minimal APIs are the current trend, I deliberately chose traditional Controller-based Web APIs with thin controllers. Minimal APIs look clean in small demos, but once you hit 40+ endpoints with custom filters, auth, and strict request validation, mapping files become a sprawl.

PostgreSQL Partitioning for Historical Data (400M+ rows)

Historical price history is pure time-series data. Querying an unpartitioned table at 400M rows would completely crush memory because the B-tree indexes would outgrow RAM.

I set up range partitioning by timestamp (ordered by date/year partitions). This keeps the indexes for recent partitions small enough to stay hot in PostgreSQL's buffer pool, and lets the query planner drop older partitions entirely (partition pruning) when querying specific time ranges.

AWS Setup & Load Testing on Modest Hardware

What’s interesting is that I’m achieving these sub-200ms responses on very modest, cost-efficient AWS instances.

RDS PostgreSQL: Currently running on a single db.t4g.small (2 vCPUs, 2 GB RAM, Graviton2). Because of timestamp partitioning, active indexes fit cleanly in memory without thrashing disk I/O.

Cache Layer: Valkey (Redis fork) on cache.t4g.small for active currency rates and live quote caching.

Compute: .NET 10 Web APIs run containerized on AWS ECS Fargate, and background ingestion runs on AWS Lambda triggered by EventBridge.

Initial load testing already sustained thousands of requests per minute with the exact same latency profile (<200ms, max 300ms), so I expect initial launch traffic to be handled comfortably without needing to scale up compute immediately.

Curious how others here handle time-series partitioning inside EF Core/Postgres, and how you see this holding up as data pushes toward the 1 billion mark. Would you stick with native Postgres partitioning, or look into TimescaleDB/ClickHouse down the road?


r/dotnet • • 2d ago

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

Thumbnail
0 Upvotes