Menu

Reviewing AI‑generated C# before it hits production
📰

Reviewing AI‑generated C# before it hits production

DEV Community: dotnet·Ankitkumar Singh·7 days ago
#jsh1WmFD
#devtodotnet#devto#dev#request#prod
Long article (4230 words) — no AI summary yet.
Reading 0:00
15s threshold

AI assistants now write a big share of the C# in our pull requests. The code compiles, the tests pass locally and the demo goes well. Then it reaches production and something breaks: a query times out, an endpoint leaks another customer's data, or the app runs out of sockets at peak load.

The problem isn't that AI writes bad code. It writes plausible code, tuned for the happy path it was shown. Production is where the unhappy paths live. This post covers the mistakes I see most often in AI-generated C#, why "works on my machine" keeps happening, and the checks I now run before anything ships.

What went wrong:

Each snippet below is the kind of code an assistant hands back when you ask for "an endpoint that does X". Every one of them works in a demo. For each, I cover why the assistant wrote it, what breaks in production, and how to catch it in review.

1. SQL built with string interpolation

// AI-generated: works, and is injectable var orders = await _db . Orders .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.