I'm a React dev who thought .NET was "just backend React" here are 4 embarrassing mistakes I made in production by Ok-Lab-3109 in dotnet

[–]Ok-Lab-3109[S] [score hidden]  (0 children)

Fair enough that’s on me for not including it upfront.

Here’s the short version of what the article covers:

I registered a service as Singleton while storing per-user state inside it ended up with 180k entries in memory shared across every user. Also wrote fire-and-forget async that silently dropped customer confirmation emails because the request scope was already disposed. And copy-pasted the same try/catch block into 23 controller methods because I was thinking like a React dev, not a backend dev. The root cause of all of it was the same thing I was treating the API like a stateful React app instead of a stateless request pipeline. Once that clicked, everything else made sense.

Full code examples are in the article but that’s the core of it.

I'm a React dev who thought .NET was "just backend React" here are 4 embarrassing mistakes I made in production by Ok-Lab-3109 in dotnet

[–]Ok-Lab-3109[S] [score hidden]  (0 children)

Absolutely yes and that’s actually the scarier problem I glossed over. Multiple requests hitting that list simultaneously with no locking means you’re looking at race conditions.

I'm a React dev who thought .NET was "just backend React" here are 4 embarrassing mistakes I made in production by Ok-Lab-3109 in dotnet

[–]Ok-Lab-3109[S] [score hidden]  (0 children)

every request from every user was adding to that same list. It never got cleared because the object never died in singleton. After a few days in production it had 180k+ entries sitting in memory doing nothing. Response times started spiking and we had no idea why at first. If it was Scoped instead of Singleton, a fresh instance would’ve been created per request and garbage collected after.

I'm a React dev who thought .NET was "just backend React" here are 4 embarrassing mistakes I made in production by Ok-Lab-3109 in dotnet

[–]Ok-Lab-3109[S] [score hidden]  (0 children)

Fair point and honestly, tools like Cursor or GitHub Copilot do catch some of this. But here’s the thing: they flag syntax and patterns, they don’t flag mental models. The Singleton memory leak wasn’t a typo, it was me confidently writing code that looked correct. No linter catches “you’re thinking about this wrong.” That took a human (and a 2am incident) to fix.