Home / Blog / .NET development /.NET Architecture Mistakes That Quietly Wreck Production Systems

9 Common .NET Architecture Mistakes That Quietly Wreck Production Systems

background

Stay in touch

Leave your email and we will inform you about all our news and updates

On November 10, 2026, .NET 8 and .NET 9 both leave support on the same day. A lot of teams will hit that date and find the retarget was the easy part – the architecture underneath it is what actually resists change.

That is the pattern with structural mistakes: they do not announce themselves. The build stays green, the tests pass, and then a p95 doubles after a data volume increase, a bug reproduces only under concurrent load, or a two-line feature request turns into a four-day change spread across eleven files.

This guide covers nine .NET architecture mistakes that behave exactly that way. Each one is paired with the symptom you would observe first, the structural cause underneath it, and what it costs to leave alone. It closes with a decision path for choosing between refactoring, rewriting, and reinforcing the team that owns the code.

Why .NET architecture mistakes cost more than bad code

A code mistake is local. A null reference in a controller action breaks one endpoint, someone finds it, and a pull request closes it. An architecture mistake is a decision about structure – where logic lives, what depends on what, how services talk – and its cost is paid by every future change that has to route around it. The fix is never one pull request.

The most-cited number on what that costs is Stripe's Developer Coefficient survey of over 1,000 developers, which found engineers spending 13.5 hours a week on technical debt and another 3.8 on bad code – 17.3 of a 41.1-hour week. Treat the precise figure with care: it is 2018 data and self-reported. The directional point is what matters and has not aged. Structural debt does not consume a slice of your engineering budget at the margin; it consumes it at roughly the scale of a second engineering team you are not getting output from.

The exposure is wide. In the 2025 Stack Overflow Developer Survey, 29.9% of professional developers reported extensive work in C#, 21.3% in ASP.NET Core, and 15% in classic ASP.NET – meaning a substantial share of production .NET runs on a framework generation that predates most of the patterns below. These mistakes usually surface when a team inherits that kind of codebase, whether from an acquisition, a departed tech lead, or one of the top .NET development companies that built the first version, and discovers that every new feature costs more than the last one did.

The architecture debt diagnostic framework

Most lists of architecture mistakes give you a checklist and leave the prioritization to you. That is the wrong way round: you almost certainly have several of these, and fixing them in the wrong order burns a quarter with nothing measurable to show for it. The framework below runs in the opposite direction – start from a symptom you have actually observed in production or in your own velocity, trace it to the likely structural cause, then price the cost and the urgency.

Two rules keep it useful rather than decorative. Only fill in rows where you have observed the symptom yourself – architecture assessments fail most often by cataloging every theoretical weakness and producing a backlog nobody can act on. And keep the business-impact column in the units your organization actually budgets in: engineer-days per change, incident minutes, cloud spend. “High coupling” does not compete for a quarter's capacity. “Every pricing change takes three days and two deploys” does.

Each of the nine sections below matches one row: the symptoms are the ones you would see first, and the fix urgency reflects whether the mistake degrades gradually or fails suddenly under load.

Symptom observed
Likely architectural cause
Business impact
Fix urgency
Business rules can only be tested through an HTTP call or a real database
Layer bleed: logic in controllers, queries in UI code
Slow test suite; regressions ship undetected
Now
A trivial CRUD change touches 6+ files across 4 projects
Over-applied Clean Architecture on a simple domain
Onboarding drag; every estimate inflated
Next quarter
Intermittent wrong-user or stale-state bugs that never reproduce locally
DI lifetime mismatch (captive dependency)
Correctness and data-leak risk; long incident tails
Now
Endpoint latency scales with row count; query log shows repeated identical SQL
N+1 from lazy loading or navigation access in loops
Latency and DB cost grow with success
Now
Timeouts and memory spikes appear only on the largest tenants
Unbounded result sets, no pagination or streaming
Outages concentrated on your biggest customers
Now
A schema change in one service breaks another service's deploy
Shared database behind nominally independent services
Release coordination overhead; no team autonomy
Next quarter
One slow dependency takes down unrelated endpoints
Synchronous call chains with no timeout or breaker
Correlated outages; blast radius exceeds the fault
Now
Deadlocks or thread-pool starvation under load, fine in staging
Blocking on async code; async void outside handlers
Capacity collapse at peak traffic
Now
Incidents are diagnosed by reading logs on individual servers
Unstructured logs, no distributed tracing
MTTR measured in hours; root cause often never found
Next quarter

How to use it: score each row you can honestly fill in on impact against fix effort, then take the two highest-impact rows only. A diagnostic that produces nine parallel workstreams has failed at the same job as no diagnostic at all.

Mistake 1: Business logic mixed with presentation or data access

This is the root-cause mistake most of the others grow out of. The symptoms are recognizable on sight: discount rules living inside a controller action, an EF Core query composed inside a Razor page, a validation branch that exists in three places because three entry points each needed it. Microsoft's own guidance for a single-project ASP.NET Core app is explicit that presentation concerns belong in views, data access belongs in the data layer, and business logic belongs in services – and warns that the absence of that discipline produces spaghetti code.

It happens for a rational reason, which is why scolding does not fix it. Under a deadline, putting the rule where the request arrives is the shortest path to a working feature, and nothing in the toolchain objects. The cost arrives later in a measurable form: business rules that can only be exercised through an HTTP request and a real database. Once that is true, your fastest feedback loop is an integration test suite, and every rule change is gated behind it.

The fix that does not work is reorganizing folders. Moving a class into a Services/ directory changes nothing about what it can reference. Boundaries hold only when they are enforced by the compiler – a separate project that has no reference to your data access assembly cannot accidentally query the database, no matter what a tired engineer types at 6pm:

// Domain project — no reference to EF Core, ASP.NET Core, or the DbContext.
public sealed class PricingPolicy
{
    public Money Apply(Order order, CustomerTier tier) => /* pure rule */;
}

// Infrastructure implements an interface the domain defines; the arrow points inward.

Main trade-off: compiler-enforced boundaries mean more projects and a slower build. That is a real cost, and it is why the next mistake exists.

Mistake 2: Over-engineering Clean Architecture

The counter-mistake is now as common as the original, and it is more expensive to unwind because it looks like diligence. The signs are consistent: five layers to serve a CRUD screen, an interface with exactly one implementation that will never have a second, a repository wrapping DbContext (which is already a repository), and a new field on an entity that requires edits in a DTO, a mapper profile, a command, a handler, a validator, and a controller before it reaches the database.

Microsoft's architecture guidance is more qualified than the way it usually gets quoted. It recommends the Clean Architecture arrangement – with the eShopOnWeb reference application and the ardalis solution template as the concrete examples – for non-trivial monolithic applications. That qualifier does the work most teams skip. Ports and adapters exist to make implementations swappable and business rules testable in isolation; where neither benefit is being collected, the layers are pure carrying cost.

Microsoft publishes no first-party guidance on vertical slice architecture, so this is not a choice between two official positions. The pattern was popularized by Jimmy Bogard, and its argument is narrow and worth taking seriously: organize by feature rather than by technical layer, so a change to one use case touches one folder instead of one folder per layer. The two are not mutually exclusive – dependency direction is an architectural property, folder organization is not. A pragmatic default is vertical slices as the standard shape, with full layering reserved for the parts of the domain that carry real rules.

Best for full layering: domains with real invariants, long-lived core systems, and code that outlives the team that wrote it.

Not ideal for: CRUD-dominant modules, admin tooling, and anything where the abstraction has exactly one implementation and always will.

Mistake 3: Dependency injection lifetime mismatches

This one is worth close attention because it produces the least debuggable class of failure in .NET: correctness bugs that appear only under concurrency, never reproduce locally, and leave no stack trace pointing at the cause. The canonical case is the captive dependency – a term Microsoft's DI guidelines credit to Mark Seemann – where a longer-lived service holds a shorter-lived one. Register a singleton that takes a scoped dependency in its constructor and the scoped service is created once, then shared across every request for the life of the process.

Because AddDbContext registers DbContext with a scoped lifetime by default, the most common version of this is a singleton cache or background service quietly holding a single DbContext for the entire application lifetime – an object that is not thread-safe, accumulates tracked entities indefinitely, and will eventually serve one user's data to another. Microsoft's guidance names the same failure mode as scope leakage: a singleton captures scoped or transient dependencies and effectively promotes them to singletons.

The container will tell you, if you let it. Enabling scope validation turns the misconfiguration into a startup exception rather than a production incident:

// Development: fail fast at startup instead of silently at 3am.
builder.Host.UseDefaultServiceProvider((ctx, options) =>
{
    options.ValidateScopes  = ctx.HostingEnvironment.IsDevelopment();
    options.ValidateOnBuild = ctx.HostingEnvironment.IsDevelopment();
});

// Throws: "Cannot consume scoped service 'Bar' from singleton 'Foo'."

Two related anti-patterns travel with this one. Microsoft advises against the service locator pattern – resolving from IServiceProvider inside a class instead of declaring dependencies in the constructor – because it hides the dependency graph from the compiler and the reader alike, which is exactly what makes lifetime bugs invisible. An asynchronous DI factory that blocks on Task.Result will deadlock the container at startup. And where a singleton legitimately needs scoped work, the supported route is IServiceScopeFactory.CreateScope() inside the method that needs it, not constructor injection.

Mistake 4: N+1 queries from lazy loading and navigation access in loops

The signature is unmistakable once you look for it: an endpoint whose latency scales with the number of rows returned, and a query log full of the same parameterized SQL repeated dozens of times with a different id. EF Core's performance documentation walks through the exact case – iterating blogs and touching blog.Posts inside the loop issues one query for the list and then one additional round trip per item. Microsoft's recommendation is unambiguous: avoid lazy loading, because eager and explicit loading make the round trip visible in the source.

The fix is projection rather than more Include() calls. Selecting only the columns the endpoint returns collapses the round trips into one query and cuts the payload at the same time. It also sidesteps change tracking – EF Core does not track projections to anonymous types – which matters more than it sounds. Microsoft's own benchmark, loading 10 blogs with 20 posts each, puts a tracking query at 1,414.7 µs and 380.11 KB allocated against 993.3 µs and 232.89 KB for the equivalent no-tracking query: 71% of the time and 61% of the allocations, from one method call.

Inefficient pattern
Optimized pattern
Query
var blogs = await db.Blogs.ToListAsync();
foreach (var b in blogs)
    Use(b.Posts); // lazy load
var rows = await db.Blogs
  .Select(b => new { b.Url, Count = b.Posts.Count })
  .ToListAsync();
Round trips
1 + N (one per blog)
1
Columns transferred
Every column on Blog and Post
Only Url and an aggregate
Change tracking
Full snapshot of every entity
None — anonymous projection

One caution on the obvious alternative. Chaining several collection Include() calls trades N+1 for cartesian explosion: the JOIN duplicates the parent row once per combination of children, and the duplicated data can dwarf the useful payload. Where two or more collections genuinely have to be loaded, AsSplitQuery() is the documented escape hatch – at the cost of one database round trip per query in the current implementation.

Mistake 5: Unbounded result sets with no pagination or streaming

This is the mistake that only ever fails in production, and it fails on your largest customers first. A query with no Take() returns every row matching its filter, and as EF Core's documentation points out, test databases contain little data, so the query behaves perfectly right up until real volume arrives. The failure mode is not a gradual slowdown – it is a timeout and a memory spike on one tenant while every other tenant looks fine, which is also why it survives so long in a codebase.

Two separate decisions are hiding in here. The first is limiting the result set, where Skip/Take is the intuitive implementation and, per Microsoft's guidance, an inefficient one at depth; keyset pagination is the recommended alternative where users move a page at a time rather than jumping to arbitrary offsets. The second is buffering versus streaming. ToListAsync() pulls the entire result into memory, so its memory profile grows with row count, while iterating with AsAsyncEnumerable() holds one row at a time and stays flat whether the query returns one row or a hundred thousand.

Worth knowing: EF Core also buffers internally in two cases – when a retrying execution strategy is configured, and for all but the last query in a split query – so a ToList over a retrying strategy loads the result set into memory twice.

Mistake 6: A shared database behind nominally independent services

The tell is organizational, not technical: a schema change in one service requires a scheduling conversation with another team. If your services deploy independently but their migrations do not, they are not independent services. They are a distributed monolith with the operational cost of microservices and none of the autonomy.

AWS's prescriptive guidance on the shared-database-per-service pattern is unusually clear-eyed about what this actually buys and costs. It introduces coupling at both development time and runtime: schema changes have to be coordinated across teams, and a long-running transaction in one service can lock a table another service depends on. The guidance also names the specific thing to avoid if you are stuck with a shared database – hot tables that multiple services write to – and the specific discipline that makes it survivable, which is that every schema change stays backward-compatible across the current and previous versions of all consumers.

In .NET the intermediate step is well trodden and does not require breaking the deployment unit. A modular monolith gives each module its own DbContext, schema, and migration history inside a single application, with cross-module access going through an explicit interface rather than a foreign key. That produces the boundary and the ownership without the network, the distributed transactions, or the service mesh – and it leaves extraction open later, because a module with a private schema is a service that has not been deployed separately yet.

Not ideal for: brownfield systems where the domain boundaries are still genuinely unknown. Splitting a database along the wrong seam is more expensive to reverse than leaving it shared for another two quarters.

Mistake 7: Synchronous call chains with no timeout or circuit breaker

This is the mistake that turns a small fault into a broad outage. Service A calls B, which calls C. C slows down. B's threads accumulate waiting on C, A's threads accumulate waiting on B, and endpoints with no dependency on C at all begin failing because there is no capacity left to serve them. The blast radius is a function of the call graph, not of the fault.

The pattern that contains it is old and well described. AWS's summary of the circuit breaker – popularized by Michael Nygard – captures the reason retries alone make things worse: when the callee is genuinely down rather than transiently erroring, repeated retries consume connection and thread pool capacity and amplify the original problem across the whole application.

This one has become cheap to fix in .NET specifically. Since .NET 8, Microsoft.Extensions.Http.Resilience ships a standard pipeline built on Polly v8 that combines a rate limiter, a total request timeout, retry, a circuit breaker, and a per-attempt timeout behind one extension method on the HTTP client builder:

builder.Services.AddHttpClient<PricingClient>(c =>
{
    c.BaseAddress = new Uri("https://pricing.internal/");
})
.AddStandardResilienceHandler();  // rate limiter + timeouts + retry + breaker

One line is not a strategy on its own: the defaults still have to be reasoned about against your dependency's real latency profile, and a breaker that opens too eagerly is its own outage. But the argument that resilience patterns cost more than they return no longer holds in this ecosystem. A call chain with no timeout is now a choice, not an oversight.

Mistake 8: Incorrect async/await usage

Three failure modes account for most of what goes wrong here, and Microsoft's own catalog of common async bugs documents each of them.

Blocking on async code. Calling .Result, .Wait(), or GetAwaiter().GetResult() on a thread with a single-threaded synchronization context deadlocks: the continuation needs the thread that the blocking call is holding. The nuance that trips people up is that modern ASP.NET Core has no synchronization context, so this does not deadlock there – it does something less obvious instead. Blocked request threads accumulate, and as EF Core's performance guidance warns, mixing synchronous and asynchronous code makes it easy to trigger subtle thread-pool starvation. You do not get a hang; you get a service that stops scaling at peak and looks healthy in staging.

async void outside event handlers. An async void method returns no task, so there is nothing for a caller to await and nothing to observe. Exceptions do not propagate to the caller – they surface on the synchronization context that was active when the method started, which in a server application usually means the process. The method also cannot be awaited in a test, so it tends to be the least-covered code in the repository as well as the most dangerous.

Context assumptions in library code. A library that resumes on the caller's context inherits whatever that context does, which is why ConfigureAwait(false) belongs on every await in code you ship for others to consume. Inside an ASP.NET Core application it is largely unnecessary, since there is no context to capture. Worth stating precisely rather than applying as a habit: this is guidance for library authors, not a blanket rule.

Cheapest safeguard: an analyzer that fails the build on async void and on blocking calls inside async methods. Both are trivially detectable statically, which makes them a poor use of code review attention.

Mistake 9: Missing observability and unstructured logging

The other eight mistakes cause incidents. This one determines how long those incidents last. When diagnosis means SSH-ing to instances and grepping text files, the mean time to resolution is bounded by how fast a human can read, and a fault that spans three services frequently never gets a root cause at all – it gets a restart and a ticket that stays open.

Three specific gaps do most of the damage. The first is unstructured output: Console.WriteLine, or string interpolation inside a logging call. The second is more subtle than it looks, because Microsoft's logging guidance points out that an interpolated string is evaluated even when the log level is disabled – so it costs you performance and gives you a flat string that no query can filter. Message templates with named placeholders produce queryable fields at no extra effort:

// Not queryable, and the string is built even when Information is off.
logger.LogInformation($"Order {orderId} rejected for tenant {tenantId}");

// Structured: orderId and tenantId arrive as searchable properties.
logger.LogInformation("Order {OrderId} rejected for tenant {TenantId}", orderId, tenantId);

The second gap is the absence of distributed tracing across service boundaries. This is no longer a maturity question in .NET: as of September 2026, the OpenTelemetry .NET implementation lists traces, metrics, and logs all as stable, and it supports every currently supported .NET and .NET Framework version except .NET Framework 3.5 SP1. There is no longer a technical reason to correlate requests by hand. (Component status does move; recheck the status table before publication if this article sits in a queue.)

The third gap is a security problem wearing a logging costume. Microsoft's engineering playbook on log privacy gives the practical version: log identifiers rather than usernames, keep sensitive values out of URLs because proxies and web servers log those by default, maintain a deny-list of properties that must never be serialized, and check logging statements explicitly in code review – reviewers habitually skim past them. ASP.NET Core's own HTTP logging documentation carries the same warning, since request and response body logging can capture personally identifiable information by default.

Refactor, rewrite, or reinforce: choosing the right fix path

Diagnosis is only useful if it resolves into a decision, and there are exactly three available. Refactor changes the structure while the system keeps running. Rewrite replaces it. Reinforce leaves the structure alone for now and changes who is working on it, on the reasoning that a team without senior architectural judgment will reproduce the same mistakes in the new codebase.

Refactor is the default, and it should take real evidence to move off it. The reason is not sentiment about legacy code – it is that incremental replacement lets you ship the whole time. Microsoft's Strangler Fig pattern documentation describes the mechanism: a façade intercepts requests and routes them to either the old or the new implementation, shifting traffic across as each slice is rebuilt. The same guidance names the two failure modes to watch, which are the façade becoming a single point of failure and removing legacy objects before the new path has been validated. Applied to the mistakes above, most of them are slice-sized: lifetime bugs, N+1 queries, and missing pagination are all fixable endpoint by endpoint behind a feature flag.

Rewrite earns consideration in a narrow set of conditions: the runtime cannot be retargeted, the domain has changed so much that the model no longer describes the business, or the boundaries are so tangled that no slice can be extracted without pulling the whole graph with it. The first is claimed more often than it is true – .NET 8 and .NET 9 both lose support on November 10, 2026, but moving to .NET 10 is a retarget, not a rewrite. Be skeptical of anyone quoting a rewrite-failure percentage at you; the widely circulated figures do not trace to a locatable primary study. The honest case against rewrites does not need one: during a rewrite you are paying for two systems and shipping features to neither.

Reinforce is the option that gets skipped, and it is often the correct first move – particularly where the diagnostic keeps landing on judgment-shaped mistakes like DI lifetimes and boundary decisions rather than on any single component. Adding senior .NET capacity to review and lead the remediation is lower-risk than a rewrite and faster than a hiring cycle, which is why teams facing a hard date frequently bring in dedicated .NET developers to run the refactor alongside the people who know the domain. The transferable asset is the review discipline, not the code the contractors write.

What actually stops these mistakes from coming back

Read the nine mistakes together and a single cause shows through most of them. Layer bleed, over-abstraction, captive dependencies, N+1 queries, blocking on async – none require unusual incompetence. They require a competent developer making a locally reasonable decision without anyone in the room who has seen where that decision leads in eighteen months. Junior-heavy teams under deadline pressure are not the exception in this failure mode; they are the mechanism.

Two governance practices do most of the preventive work, and neither is expensive. The first is architecture decision records. Microsoft's Well-Architected Framework treats the ADR as a primary architect deliverable and prescribes a specific shape worth copying: an append-only log where superseded decisions get a new record linked to the old one rather than an edit, capturing context, alternatives ruled out, and consequences – and covering only decisions that affect structure or are hard to reverse. The value is not the document. It is that writing down which alternatives you rejected forces the reasoning to happen before the code, and gives the next team a way to tell a deliberate choice from an accident.

The second is a senior-led review cadence with a scope that is explicitly structural. Ordinary pull request review catches code mistakes and reliably misses architecture mistakes, because a single diff rarely shows the pattern. A standing session that looks at dependency direction, service lifetimes, and query shape across recent changes catches things no per-PR review will.

Automate what can be automated so review attention goes to what cannot. Scope validation turns captive dependencies into startup failures. Analyzers catch async void and blocking calls. Architecture tests fail the build when a project references a layer it should not. What is left over – whether an abstraction is earning its cost, whether two modules should share a schema – is exactly the judgment the ADR and the review cadence exist to apply. Run the diagnostic table against your own system next, and do it with someone who has operated a codebase past the point where these mistakes got expensive. That experience is what turns a list of symptoms into a prioritized plan.

FAQ

Is Clean Architecture always the right choice for .NET applications?

No. Microsoft's guidance recommends it for non-trivial monolithic applications, and that qualifier matters. Clean Architecture buys swappable implementations and business rules testable without infrastructure. Where a module has neither — a CRUD screen, an admin tool, an abstraction with exactly one implementation that will never have a second — the layers add files and onboarding time without returning anything. A common pragmatic split is vertical slices by default, with full layering reserved for the parts of the domain that carry real invariants.

How do you know if a .NET application needs a rewrite rather than a refactor?

Try to extract one slice behind a façade. If a single bounded capability can be routed to a new implementation without dragging the rest of the object graph with it, you have a refactor. If nothing can be separated because every module reads every table and no boundary survives contact with the code, that is the strongest signal for a rewrite. Framework end-of-support is usually not one: retargeting from .NET 8 to .NET 10 is a recompile, not a rebuild.

What is the difference between a code mistake and an architecture mistake?

A code mistake is contained by one component and fixed by one pull request. An architecture mistake is a decision about structure — where logic lives, what depends on what — whose cost is paid by every subsequent change that has to work around it. The practical test is the blast radius of the fix: if correcting it means touching code you did not write for reasons unrelated to the feature you are shipping, it is architectural.

Can these architecture mistakes be fixed without downtime?

Most of them, yes. Lifetime misconfigurations, N+1 queries, missing pagination, async misuse, and observability gaps are all component-level and ship behind ordinary deployment practice. Splitting a shared database is the one that requires genuine care: the Strangler Fig guidance recommends running domain tables and synchronization processes in parallel, and treating removal of the legacy objects as a deliberate final step after the new path is validated — because rolling back after that removal means restoring the objects and replaying data changes.

background

Subscribe to receive notifications of new posts