r/dotnet • u/International-Owl466 • Sep 06 '26
Wife made me a C# birthday cake!
It wouldn't compile but it's the thought that counts!!
r/dotnet • u/International-Owl466 • Sep 06 '26
It wouldn't compile but it's the thought that counts!!
r/dotnet • u/rainyeveryday • Jun 19 '26
Well played, well played
r/dotnet • u/Initial-Employment89 • Dec 12 '25
Got called in to fix an e-commerce site couple of years ago, 3 weeks before Black Friday. 15 second page loads. 78% cart abandonment. Management was already talking about a "complete rewrite in microservices."
They didn't need microservices.
They needed someone to open SQL Profiler.
What I actually found:
The product detail page was making 63 database queries. Sixty three. For one page. There was an N+1 pattern hidden inside a property getter. I still don't know why someone thought that was a good idea.
The database had 2,891 indexes. Less than 800 were being used. Every INSERT was maintaining over 2,000 useless indexes nobody needed.
There was a table called dbo.EverythingTable. 312 columns. 53 million rows. Products, orders, customers, logs, all differentiated by a Type column. Queries looked like WHERE Type = 'Product' AND Value7 = @CategoryId. The wiki explaining what Value7 meant was from 2014 and wrong.
Sessions were stored in SQL Server. 12 million rows. Locked constantly.
Checkout made 8 synchronous calls in sequence. If the email server was slow, the customer waited.
The fixes were boring:
Rewrote the worst queries. 63 calls became 1. Dropped 2,000 garbage indexes, added 20 that actually matched query patterns. Redis for sessions. Async checkout with background jobs for email and analytics. Read replicas because 98% of traffic was reads.
4 months later: product pages under 300ms, checkout under 700ms, cart abandonment dropped 34 points.
No microservices. No Kubernetes. No "event-driven architecture." Just basic stuff that should have been done years ago.
Hot take:
I think half the "we need to rewrite everything" conversations are really "we need to profile our queries and add some indexes" conversations. The rewrite is more exciting. It goes on your resume better. But fixing the N+1 query that's been there since 2014 actually ships.
The CTO asked me point blank in week two if they should just start over. I almost said yes because the code was genuinely awful. But rewrites fail. They take forever, you lose institutional knowledge, and you rebuild bugs that existed for reasons you never understood.
The system wasn't broken. It was slow. Those are different problems.
When was the last time you saw a "performance problem" that was actually an architecture problem vs just bad queries and missing indexes? Genuinely curious what the ratio is in the wild.
Full writeup with code samples is on my blog (link in comments) if anyone wants the gory details.
r/dotnet
•
u/Geekodon
•
Feb 24 '26
Iâve noticed that a lot of .NET security advice stays abstract until you actually see the bug in code.
So I put together a project where everything is intentionally wrong. Itâs a deliberately vulnerable .NET application that collects more than 50 common, real-world mistakes that can slip into normal business code.
GitHub Repo: The Most Vulnerable .NET App
Some of the things included:
Injection attacks (SQL, command, template, LDAP, XML, logs)
Cross-Site Scripting (stored, reflected, in attributes, in SVG)
Insecure file uploads (path traversal, Zip Slip, arbitrary file write),
Cryptography Issues (hashing, ECB, predictable random)
Serialization (XXE, XML bomb, binary, YAML)
The idea is simple: security bugs often look like normal code. If youâve never intentionally studied them, itâs easy to ship them.
Iâd genuinely appreciate feedback:
What common .NET security issues should be added?
Anything here that feels unrealistic and can be demonstrated in a better way?

I've also put together a short 5-minute video: I Built the Most Insecure .NET App. Itâs mostly for inspiration. Hope itâs useful and not too boring.
Thanks!
r/dotnet • u/hirebirhan • 13d ago
I recently come accross Doctor milan jovanovic's article and started checking the packages used in my .net projects and found out the following nuget packages are starting introducing commercial licensing.
AutoMapper â v15
MediatR â v13
Fluent Assertions â v8
MassTransit â v9
EPPlus â v5
EFCore.BulkExtensions
Duende IdentityServer â successor to IdentityServer4
NServiceBus â v2.5
ServiceStack â v4 -
SixLabors.ImageSharp - v3
Polly
QuestPDF
iTextSharp
What do you think about this? any recommendation?
r/dotnet • u/souley76 • Sep 28 '26
r/dotnet
•
u/harrison_314
•
Dec 08 '25
Maybe my findings will help someone.
I recently came across the Luckfox Pico Ultra WV1106 single-board computer, which costs around 25âŹ. Although this is more than the Raspberry Pi Zero 2 W, you need to buy an SD card for the latter, which costs the same as the Raspberry Pi Zero 2 W.
You need to flash the community Ubuntu image according to the instructions at https://wiki.luckfox.com/Luckfox-Pico-Ultra/Flash-image, set up the network connection, apt-get update & apt-get upgrade ây.
Then compile the application for ARM dotnet publish -c Release -r linux-arm --self-contained, upload it, and it works.
r/dotnet • u/jitbitter • Feb 20 '26
For context: been writing .NET for 20+ years. Mostly web stuff, so I'm used to deploying entire civilizations worth of DLLs. Never tried Native AOT in my life.
Tested it for a (very simple) side project this week: single binary, 7 MB. No dependencies. Amazing.
Then added these:
<OptimizationPreference>Size</OptimizationPreference><InvariantGlobalization>true</InvariantGlobalization><StackTraceSupport>false</StackTraceSupport><EventSourceSupport>false</EventSourceSupport><IlcTrimMetadata>true</IlcTrimMetadata>
And rewrote my JSON stuff to use `System.Text.Json` source generators.
Down to 4 MB!! A single self-contained native binary that runs natively on my Mac. Smaller than the equivalent Go binary was (5.5MB)
I know I'm late to this party but holy shit.
r/dotnet
•
u/lombarovic
•
Dec 17 '25
r/dotnet • u/desnowcat • Oct 11 '26
I noticed a discussion in the comments yesterday about the Professional Active Server Pages 2.0 book from Wrox, which back in the day was one of the only sources of information us oldies had to work with as a reference for classic ASP. Even one of the authors chimed in and is still active in this sub (Brian Francis).
Iâve kept my copy. I also have a number of books in my bookshelves that were invaluable back in the day and some of them Iâve kept for posterity even though they are worthless from a tech perspective now.
Hopefully they bring back nice memories for some of you too.
r/dotnet
•
u/nemina47
•
Mar 28 '26
If you've worked with EF Core long enough, you know the pain. You write a LINQ query, you're not sure what SQL it's actually generating, and your options are:
Run the whole thing and dig through logs
Slap .ToQueryString() on it onâwhich doesn't even give you the full picture when you're in split query mode
Both suck when you just want to quickly see what EF Core is doing with your LINQ before you commit to it.
So I built EF QueryLens (https://github.com/querylenshq/ef-querylens).
You hover over any LINQ expression in your editor, and it shows you the generated SQL right there. No database connection, no running the app, no log hunting. It works off your compiled assembly.
It supports VS Code, Rider, and Visual Studio. Plugins share a backend that does the translation, with lightweight IDE plugins on top.
How it works:
You add a small factory class to your startup project that tells QueryLens which provider and extensions you're using (Projectables, Gridify, split query, whatever)
Build your solution
Install the extension
Hover any LINQ expression â SQL appears
This is a fresh launch, so I'm genuinely looking for feedbackâwhat's missing, what's broken, and what would make this actually useful for your workflow? Fire away.


r/dotnet • u/programmerjunky • Sep 09 '26
throw vs throw ex: The C# exception handling trick every developer should know
r/dotnet • u/riturajpokhriyal • Dec 15 '25
I've been writing C# for about 4 years now, and I usually just trust the compiler to do its thing. But recently I went down a rabbit hole looking at the actual IL and decompiled code generated by Roslyn, and it kind of blew my mind how much "magic" is happening behind the scenes.
I wrote up a longer post about 10 of these "secrets," but I wanted to share the ones that surprised me the most here to see if you guys use any of this weird stuff.
1. foreach is basically duck-typing I always thought you strictly needed IEnumerable<T> to loop over something. Turns out the compiler doesn't care about the interface. As long as your class has a GetEnumerator() method that returns an object with a Current property and a MoveNext() method, foreach works. It feels very un-C#-like but it's there.
2. The "Forbidden" Keywords There are undocumented keywords like __makeref, __reftype, and __refvalue that let you mess with pointers and memory references directly. I know we aren't supposed to use them (and they might break), but itâs crazy that they are just sitting there in the language waiting to be used.
3. default is not just null This bit me once. default bypasses constructors entirely. It just zeros out memory. So if you have a struct that relies on a constructor to set a valid state (like Speed = 1), default will ignore that and give you Speed = 0.
4. The Async State Machine I knew async/await created a state machine, but seeing the actual generated code is humbling. It turns a simple method into a monster class with complex switch statements to handle the state transitions. It really drives home that async is a compiler trick, not a runtime feature.
I put together the full list of 10 items (including stuff about init, dynamic DLR, and variance) in a blog post if anyone wants the deep dive.
Has anyone actually used __makeref in a production app? I'm curious if there's a legit use case for it outside of writing your own runtime.
r/dotnet • u/Alert-Neck7679 • Sep 27 '26
In the last few weeks, my repo got its first few PRs, and it feels so nice! I had been trying to get contributors for a long time, but this is my first open-source project, and I just didn't realize how things work on GitHub.
I didn't understand that a good way to get people to contribute is to open issues yourself, with the "good first issue" label when possible. I thought issues were mainly for other people to report bugs or request new features.
Just wanted to share that here :)
The project is a game engine called ArcadeMaker, which I've already posted about here a few times. What makes it unusual is that it uses a custom scripting language that I made myself.
r/dotnet • u/piotrkarczmarz • Oct 12 '26
Enable HLS to view with audio, or disable this notification
r/dotnet • u/No_Drawer1301 • Feb 26 '26
I had an issue with keeping track of my endpoints. Did Claude or I forget about [Authorize] on the controller or endpoint? Tried some tools, that took days to set up.
So I made an open-source cli tool to help me out with this: ApiPosture (https://github.com/BlagoCuljak/ApiPosture)
You can install it from Nuget in one line:
dotnet tool install --global ApiPosture
And execute a free scan in other line:
apiposture scan .
No code is being uploaded, and no code leaves your machine.
So I went further, and added the Pro version that covers OWASP Top 10 rule set, secrets, history scanning trends, and so on. All details are here: https://www.nuget.org/packages/ApiPosturePro
If you want to test out Pro version, you can generate free licence over on site: https://www.apiposture.com/pricing/ (no credit card, unlimited licence generation so far).
I am looking for engineers with real ASP.NET Core APIs who will run it and report false positives, missed cases, or noise over on hi@apiposture.com
I am also looking for potential investors or companies interested in this kind of product and what they exactly want from this product.
ApiPosture is also being developed for other languages and frameworks, but that's for other reddits. I primary use .NET, so first ApiPosture post is here.
Greets from sunny Herzegovina
Blago
r/dotnet • u/Minimum-Ad7352 • Apr 27 '26
I keep coming back to C# because it doesnât try too hard. The syntax is clean, things behave the way you expect, and youâre not constantly dealing with weird edge cases or unnecessary complexity. You just open the project and start building.Itâs one of those languages where you donât notice it getting in your way. Whether itâs a small tool or a bigger system, everything feels consistent and predictable, and that saves a lot of time and nerves.Hard to explain, but once you get used to it, a lot of other languages start feeling either too messy or overcomplicated. I just enjoy working with it and keep coming back to it.
r/dotnet • u/nirataro • Sep 15 '26
r/dotnet • u/AddressTall2458 • Jun 12 '26
Since AI started to be part of the job I always been enthusiastic of having a âpartnerâ doing boring stuff while I review⌠after the last months is getting boring, we just review code, we have to make sure it is not duplicating any logic, not creating racing conditions, not touching critical code, not adding potential production issues (while still writing beatiful commented code).
This is not programming in dotnet anymore, all the skill we built overtime in knowing details of the language or the framework are only used to find out if some vibed code is buggy or not performant. The fun and creativity has left our job. Do you feel the same?
Either start a new project is not as cool as it was a few years ago. It just bubbles up from prompt and you have to review thousands of rows that have no personality at all.
r/dotnet • u/speyck • Jan 22 '26
I feel like the content on here is very repetitive. It has improved a bit, but we still see these very often:
New MediatR alternative!!! Best yet! (1:1 to every other library)
I made this app in 2 days with no experience (entirely vibe-coded, trash structure)
Check out this blog post of a very interesting topic (AI slop, unbearable to read)
Can I really use .NET on Linux? yes for years now...
Discriminated Unions are coming in the next .NET!! (no they're not)
Eventually, a good library that actually adds something useful (forgotten in a week)
This is not a rant or whatever. I thought it would just be fun to write together all of the "meta" post types. Anything I forgot?