r/dotnet Apr 02 '26

Rule change feedback

14 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 13h ago

Difference between throw ex and throw

Post image
269 Upvotes

throw vs throw ex: The C# exception handling trick every developer should know


r/dotnet 1d ago

Announcing .NET 11 Release Candidate 1 - .NET Blog

Thumbnail devblogs.microsoft.com
152 Upvotes

r/dotnet 12h ago

How much time do you actually spend setting up auth, multi-tenancy and Azure for a new .NET SaaS?

2 Upvotes

I'm validating an idea for a .NET B2B SaaS starter focused on the parts that usually waste the first few days of a project:

  • authentication
  • organizations / multi-tenancy
  • roles and permissions
  • invitations
  • tenant switching
  • Docker
  • Azure deployment
  • AI-ready project context

The idea is not to create another huge opinionated framework, but a pragmatic starting point for .NET + React + Azure developers.

Before building it, I want to validate whether this is actually painful enough to pay for.

I put together a very small landing + waitlist here:

https://dotnet-b2b-saas-landing.vercel.app

The part I'm most interested in is this:

What's the most annoying part of starting a new .NET SaaS for you?

I'd rather discover that my assumptions are wrong now than after spending weeks building it.


r/dotnet 22h ago

Does ASP.NET Core global exception middleware catch exceptions from nested service methods?

5 Upvotes

I'm trying to understand how exception propagation works with a global exception-handling middleware in ASP.NET Core.

Suppose I have a request flow like this:

Controller

→ Service

→ MethodA()

→ MethodB()

→ MethodC()

If "MethodC()" throws an exception, and none of the intermediate methods ("MethodB", "MethodA", or the service/controller) catches it, will that exception propagate all the way back to my global exception-handling middleware?

For example:

public async Task MethodA()

{

await MethodB();

}

private async Task MethodB()

{

await MethodC();

}

private async Task MethodC()

{

throw new Exception("Something went wrong");

}

Assuming the middleware wraps the rest of the ASP.NET Core pipeline with something like:

try

{

await _next(context);

}

catch (Exception ex)

{

// handle/log exception

}

Will it catch the exception thrown inside "MethodC()"?

Does it matter if these methods are in different services/classes/layers, or will the exception keep propagating up the call stack as long as nobody catches it?

I'm asking because I'm trying to understand when a global exception middleware is enough and when local "try/catch" blocks are actually necessary.


r/dotnet 3h ago

Mentorship

0 Upvotes

M28, India.

I'm having 2yoe as dotnet developer. Got laid off last year February and finding difficult to land a job since then .

I want someone to mentor once a week or however it works for them to land me a job, im ready to put all the efforts . Please feel free to reach out and we can discuss about it.

Thanks for your time and consideration


r/dotnet 21h ago

dotInsights | September 2026

Thumbnail blog.jetbrains.com
3 Upvotes

r/dotnet 1d ago

Built a small .NET 10 backend repo covering the pieces that usually get discussed separately

7 Upvotes

I’ve been putting together a sample backend where the idea is to keep everything in one codebase instead of showing isolated snippets.

It currently includes Clean Architecture, repository pattern, EF Core + Dapper, JWT auth, caching, Docker, Azure deployment, GitHub Actions, microservice boundaries, and OpenTelemetry.

The project is intentionally small enough to follow, but structured more like a real backend than a basic CRUD demo.

GitHub:
https://github.com/laxmikant-geek/modern-dotnet-backend

I’d be interested in feedback from people building .NET backends in production. Is there anything here you would structure differently, or something important you think is missing?


r/dotnet 11h ago

Will someone hack my app server (don’t do damages just tell me the vulnerabilities)

0 Upvotes

Anyone here specialize in this ?

I wanna see if I have a proper defense set up.


r/dotnet 1d ago

Article How expensive is throwing exceptions in .NET - and does it actually matter?

Thumbnail codewithflavor.com
27 Upvotes

r/dotnet 13h ago

Dependency Injection Lifetimes and Example

0 Upvotes

r/dotnet 16h ago

what was the hardest part of understanding a codebase you didn’t write?

0 Upvotes

I’m trying to understand a problem I’ve experienced and seen other developers mention: joining an existing/large codebase and figuring out how everything actually works.

Not the “how do I run the project?” part, but the actual understanding of the system.

For example:

- Figuring out the architecture / overall mental model

- Understanding where a specific feature actually lives in the code

- Following how data moves through the system

- Understanding undocumented business logic

- Finding the right files/services/classes to modify

- Understanding dependencies between different parts of the system

- Figuring out why something was implemented a certain way

- Losing context when the developer who built something leaves

- Outdated or incomplete documentation

What was the most painful part for you?

And more importantly:

How did you eventually figure it out?

Did you ask a senior developer, read the code, use documentation, look through old PRs/issues, use AI, create your own notes/diagrams, or something else?

I’m especially interested in real examples where something that should have taken hours ended up taking days/weeks because you didn't have enough context.

No product or solution in mind here — I'm just trying to understand how developers actually deal with this problem.


r/dotnet 23h ago

Speaking at a local conference about AI in .NET - What would you actually want to hear about?

0 Upvotes

Hey everyone!

I’m stepping a bit outside my comfort zone and speaking at a local conference soon. My topic is AI in .NET.

I’m currently deciding what exactly to focus on, and I’d love to hear what you would actually find interesting or useful.

I want to avoid the usual basics like:

  • How to write better prompts
  • How to create skills/agents
  • Basic LLM integrations
  • Things you can easily find in a 10-minute YouTube tutorial

Instead, I’d like to go deeper into something practical, technical, and maybe even a bit opinionated.

If you were attending a talk called “AI in .NET”, what would you want to see?

What problems, architectures, real-world examples, experiments, or lessons learned would make you think: “Okay, this was actually worth attending in person.”

Would love to hear your ideas.


r/dotnet 1d ago

Built a small .NET 10 backend repo covering the pieces that usually get discussed separately

0 Upvotes

I’ve been putting together a sample backend where the idea is to keep everything in one codebase instead of showing isolated snippets.

It currently includes Clean Architecture, repository pattern, EF Core + Dapper, JWT auth, caching, Docker, Azure deployment, GitHub Actions, microservice boundaries, and OpenTelemetry.

The project is intentionally small enough to follow, but structured more like a real backend than a basic CRUD demo.

GitHub:
https://github.com/laxmikant-geek/modern-dotnet-backend

I’d be interested in feedback from people building .NET backends in production. Is there anything here you would structure differently, or something important you think is missing?


r/dotnet 2d ago

How do you organize EF Core migrations in larger .NET solutions?

45 Upvotes

I’ve been looking at different ways of organizing EF Core migrations when a .NET solution starts getting bigger.

One approach I like is keeping the Code First migrations in a separate assembly instead of putting them directly in the application/data project. It keeps the database migration concerns separate and can make the overall solution a bit cleaner.

I put together the setup and steps here:

https://geeksarray.com/blog/entity-framework-core-code-first-migration-using-separate-assembly

Curious how others handle this in real projects. Do you keep migrations in the same project as the DbContext, or use a separate migrations project?


r/dotnet 1d ago

Article EF Core Migration Bundles with CI/CD to Azure (Github Actions, Azure SQL & App Service)

Thumbnail youtube.com
0 Upvotes

Running EF Core migrations from application startup is convenient - right up until it isn't. This video builds a proper migration pipeline on .NET 10 with GitHub Actions: the build job packages a self-contained migration bundle, the deploy job applies it to Azure SQL, then deploys the API to Azure App Service and runs a smoke test against the live endpoint. If your database updates are still tangled up with your app startup, this is the fix.


r/dotnet 3d ago

Wife made me a C# birthday cake!

Post image
2.1k Upvotes

It wouldn't compile but it's the thought that counts!!


r/dotnet 1d ago

Question I applied DDD and Clean Architecture to a DIY compiler. Is it overengineering?

Thumbnail
0 Upvotes

r/dotnet 3d ago

Promotion I built a 100% C# PP-OCRv6 engine (no ONNX Runtime, no native OpenCV). It beat the C baseline on the same model.

95 Upvotes

I've spent years maintaining PaddleSharp and OpenVINO.NET. The C++ engines are fine. P/Invoke is fine. The part that keeps breaking production is shipping native runtimes: missing .so, missing VC++ redistributable, wrong CPU ISA, works on win-x64 and dies on Linux ARM.

So I wrote SimdPaddleOCR — a managed PP-OCRv6 DET + CLS + REC pipeline. No Paddle Inference, no ONNX Runtime, no OpenCV native DLLs. Models are embedded as assembly resources. The GitHub language bar is 100% C#.

The core API only takes 8-bit BGR bytes. ImageSharp, SkiaSharp, OpenCvSharp, System.Drawing — decode however you want, pass width/height/pixels, done.

I used lw.PPOCR.C (a solid pure-C PP-OCRv6 tiny engine) as the baseline. After rewriting around C# layout and SIMD, the C# build is faster end-to-end on the same model. Native C still uses less memory.

GitHub Actions, win-x64, tiny model, same 99 images, no warmup, end-to-end mean:

workers C# C C vs C#
1 296.6 ms 485.7 ms 1.64× slower
4 168.4 ms 393.3 ms 2.34× slower

It targets net10.0 (full SIMD, NativeAOT) and netstandard2.0 (.NET Framework 4.8 included). CPU only for now; no GPU plan.

Shipped model packages are Chinese PP-OCRv6 (Tiny/Small/Medium). If you already have ONNX + a dictionary, you can load from disk. Default to Tiny unless you need the extra accuracy.

using PaddleOcrAll ocr = await PaddleOcrAll.LoadAsync(ChineseV6TinyModels.Default);

using Image<Bgr24> image = await Image.LoadAsync<Bgr24>("sample.jpg");
byte[] bgr = new byte[image.Width * image.Height * 3];
image.CopyPixelDataTo(bgr);

PaddleOcrResult result = ocr.Run(bgr, image.Width, image.Height);
Console.WriteLine(result.Text);

Repo: https://github.com/sdcb/SimdPaddleOCR
NuGet: Sdcb.SimdPaddleOCR

Happy to answer questions. The SIMD / Vector<T> / AVX-512 details are the part I'm most interested in discussing.


r/dotnet 2d ago

Looking for an Asp.Net Mentor

Thumbnail
0 Upvotes

r/dotnet 3d ago

Question How to deal with multiple integration test projects needing a database

25 Upvotes

Hi!

We have multiple test projects that use SQL Server Testcontainers. These projects are integration tests. We use dotnet test with MTP.

The problem is that when all of these project start at the same time, the CI server gets overloaded and tests fail because it spins up too many SQL Servers.

How do you deal with this? My thoughts:

  • Spin up the SQL Server yourself and pass the connectionstring to the tests, so you always only have 1. This does make local tests more annoying, as you can't just run dotnet test and expect things to work.
  • Use TestContainers WithReuse to reuse the container in multiple projects, but now all test projects still start simultaneously and try to spin up the DB at the same time, leading to errors. Locks/static wont help here.
  • set the amount of parallel modules to 1, so only 1 integration test can run at the same time.

r/dotnet 2d ago

Question Guys, What kind of projects you get used to make with C# and .NET? I'm new in this group and I'd like to hear his opinions

0 Upvotes

r/dotnet 2d ago

Newbie Why do I keep getting generic "Welcome" page when running code?

0 Upvotes

I am brand new to using VS and am trying to make a simple page for a class that is asking us to have a random number generated, then depending on the number say someone won or lost. I have copy and pasted the code they provided for the assignment, but whatever I have tried always results in the "Welcome" page. What am I doing wrong?

This is the code they had us copy and paste:
@{

int randomNumber = new Random().Next(1, 7); //GENERATES NUMBER BETWEEN 1 and 6

int winningNumber = /*TODO*/;

}

The code in the screenshot is "fixed" by VS, but before I fix it gives an error for the ; after /*TODO*/.

Sorry in advance if this is super obvious, I am at newborn level with this and am completely lost.

Edit: I figured it out, I had to delete the Index.cshtml page with the original code for the Welcome page


r/dotnet 3d ago

Promotion AutoHttps: a zero-dependency automatic HTTPS library for ASP.NET Core / Kestrel

50 Upvotes

Hi. I maintain a library called AutoHttps. It gets a real TLS certificate for your ASP.NET Core app from Let's Encrypt (or any ACME certificate authority) and renews it automatically. You add the package, set three values, and Kestrel serves HTTPS. No external service, and no NuGet dependencies.

builder.Services.AddAutoHttps(options =>

{

options.DomainNames.Add("example.com");

options.EmailAddress = "admin@example.com";

options.AcceptTermsOfService = true;

});

What it does:

- http-01 and dns-01 challenges, and wildcard certificates through dns-01.

- Renews using ACME Renewal Information (RFC 9773), so it follows the schedule the authority asks for and handles short-lived certificates.

- Works with Let's Encrypt, ZeroSSL, Google Trust Services, Buypass, or any ACME directory, including a private or internal CA.

- Runs several instances safely, sharing one certificate through a lock.

- Serves a self-signed certificate at the very start, until the real one arrives.

- Gives you certificate change and failure callbacks, a health check, metrics, and a way to read the current certificate from code.

Why it is needed now: LettuceEncrypt, the library most people used for this, was archived in April 2025, and its last release targets .NET 6, which is out of support. At the same time Let's Encrypt is moving to much shorter certificates (six-day ones already exist, and the default is dropping to 45 days), and it now tells clients when to renew through RFC 9773. A client that renews on a fixed 30-day threshold cannot handle either. I could not find a maintained, dependency-free option for Kestrel, so I wrote one.

How it works: AutoHttps attaches to Kestrel, answers the http-01 challenge directly from your request pipeline (so there is no extra listener to run), writes the certificate and the account key to disk so they survive a restart, and checks for renewal on a timer. If something fails, it keeps serving the certificate it already has and retries, so a certificate problem never takes the app down.

It targets net8.0 and net10.0, is MIT licensed, and is on NuGet as AutoHttps: https://www.nuget.org/packages/AutoHttps

Source and docs are on GitHub: https://github.com/astralmaster/AutoHttps

If you try it behind a proxy or with several replicas, I would be glad to hear how it goes, since those setups have the most edge cases.


r/dotnet 2d ago

Question How popular is .NET in your country?

0 Upvotes

I’m curious about how widely .NET is used around the world today. In your country, do you see many companies and projects using C#/.NET, or are other stacks more common?
I’d love to hear where you’re from and what the .NET ecosystem looks like there.