Working with C#?

C# NullRef storms or async deadlocks in production? We fix it.

C# is a mature language with a long tail of codebases still on .NET Framework 4.8 next to greenfield services on .NET 9. We work in both worlds: find the NullReferenceException that nullable reference types would have caught, untangle the async handler that blocks on a Task.Result, and get the solution building on the current SDK.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

dotnet-build.log

still failing

What it is

C# at a glance

C# is a statically typed, multi-paradigm language created at Microsoft under Anders Hejlsberg and first released in 2002. It runs on the Common Language Runtime and is the primary language for .NET across server, desktop, mobile and game development.

The modern language has records, pattern matching, async and await, nullable reference types, source generators and top-level statements. It is a common choice for enterprise line-of-business applications, ASP.NET Core APIs and MVC sites, WPF and WinForms desktop software, Unity games and Blazor web applications. The ecosystem spans Visual Studio, Rider, NuGet, Entity Framework Core and a broad library landscape built up over two decades.

Type
Managed, statically typed language
First released
2002 (1.0)
License
MIT (Roslyn compiler)
Maintained by
Microsoft and the .NET Foundation
Typically used for
ASP.NET APIs, enterprise applications, desktop software, Unity games, Blazor web apps, Azure Functions

The honest version

C# pros and cons

No technology is all upside. This is where C# earns its place and where it tends to cause trouble.

Where C# is strong

  • Strong, modern language with steady releasesRecords, pattern matching, init-only setters, required members and primary constructors land on a yearly cadence. The language keeps evolving without breaking most existing code.
  • Async and await done wellThe async model is built into the language and the runtime. A handler returning Task is first class, and the standard library expects it, which makes I/O-heavy code natural to write.
  • Nullable reference typesOpting a project into nullable catches a huge share of NullReferenceException bugs at compile time. The transition is a chore but the payoff is a quieter production.
  • Mature toolingVisual Studio, Rider, dotnet CLI, dotnet-trace, dotnet-dump and dotnet-counters give a senior engineer everything they need to debug and profile a live process.
  • Entity Framework Core is good enough for most appsLINQ queries compile to SQL that modern EF generates sensibly, migrations work, and change tracking is usable. For the rare query that EF cannot express, raw SQL is a one-liner.
  • The CLR is a strong runtimeJust-in-time and ahead-of-time compilation, a generational garbage collector that has been tuned for twenty years, and span-based APIs that let performance-sensitive code avoid allocations entirely.

Where C# bites

  • Legacy .NET Framework lives onPlenty of C# in the wild is still on .NET Framework 4.8 with no plan off, which means WCF, Web Forms, Katana middleware and an IIS deployment story that modern tutorials no longer cover.
  • Nullable types adoption is painful on old codeTurning on nullable in a ten-year-old project surfaces thousands of warnings. Fixing them properly takes weeks; suppressing them with ! defeats the purpose.
  • Async over sync is a trapCalling Task.Result or Task.Wait in an ASP.NET context deadlocks the request. Legacy code full of this pattern cannot simply be moved to .NET 8 without a careful rewrite.
  • Entity Framework can hide performance cliffsA LINQ query that compiles fine can emit a SQL statement that scans a whole table, and lazy loading can turn one screen into hundreds of round trips if nobody is watching.
  • Configuration has too many ways to do itConfigurationManager, appsettings.json, environment variables, user secrets, Azure App Configuration and Key Vault all have overlapping stories. New teams pick the wrong one for their situation more often than not.
  • Migrations between .NET versions carry workEach major version deprecates something, and projects stuck on old versions eventually hit end-of-support on security patches. Upgrades need planning rather than clicking the retarget button.

Sound familiar?

Common C# problems we fix

The C# problems that bring people to us, and what you have once each one is fixed.

System.NullReferenceException: Object reference not set

NullRef storms in production logs

A reference that was never nullable in the type system is null at runtime, usually because a configuration binding left a property default or a DTO was deserialized from JSON that was missing a field.

Null origins traced, types corrected

Thread was being aborted (Task.Result deadlock)

Async handler deadlocks under load

A controller that calls .Result or .Wait on a Task from a synchronization context that is waiting for the same thread to become free. Classic ASP.NET deadlock that only shows up under traffic.

Async flows end to end without blocking

SqlException: Timeout expired

Database calls time out intermittently

An EF Core query missing an index on the lookup column, a connection pool exhausted because contexts are not disposed, or a long-running transaction holding locks that newer queries wait on.

Queries fast, pool healthy

CS8618: Non-nullable property must contain a non-null value

Nullable enabled but models still throw

A project with nullable turned on, ORM entities and DTOs still using non-nullable properties with no initialization, and runtime nulls slipping through the compiler's checks via reflection.

Model shapes match the real data

Async method lacks 'await' operators

Methods marked async run synchronously

A method with the async modifier that never awaits anything, which produces a warning the team has ignored but turns off the async state machine entirely.

Async means async in both signature and body

Target framework: net48

Still on .NET Framework 4.8 with no upgrade plan

A large application on net48 with Web Forms, WCF and NHibernate, which Microsoft keeps patching but will not evolve. The security review wants a plan and nobody has written one.

Plan to .NET 8 with milestones

AggregateException: One or more errors occurred

Exceptions get swallowed inside Tasks

A fire-and-forget task that failed without being awaited, which surfaces later as an UnobservedTaskException with a stack trace that points nowhere useful.

Every Task awaited, errors visible

ConfigurationManager.AppSettings is obsolete

Configuration code mixes patterns

A project half-migrated from Web.config to appsettings.json, with both read from in different services and nobody sure which wins in which environment.

One configuration story per environment

What we do

C# help, from one bug to ongoing support

Call us about one failing method, or hand over the solution and we work it from the csproj up.

Rescue
Services throwing NullReferenceException, deadlocked requests, builds that will not restore. We get the process behaving before writing anything down.
Framework upgrades
Moves from .NET Framework 4.8 to .NET 8 or 9, with WCF replaced by gRPC or minimal APIs, Web Forms modernized, and Entity Framework migrations run on staging first.
Async and performance
Removing sync-over-async traps, tuning Task flows, reading a dotnet-trace dump and acting on it, and profiling hot paths with BenchmarkDotNet.
Database integration
Entity Framework Core queries reviewed, indexes added, change tracking used sensibly, and raw SQL brought in where EF generates something expensive.
Nullable migration
Turning on nullable across a legacy codebase in stages, fixing the real nulls, and leaving the compiler watching the boundary from then on.
Managed Tech
Steady work on NuGet updates, framework version bumps, security advisories and the review passes that keep a long-lived C# codebase healthy.

How it works

From first message to fixed

  1. Look Free estimate

    Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.

  2. Fix

    We fix the cause, not the symptom. If something is down, getting it back up comes first.

  3. Harden

    Backups, monitoring, updates and access, so the same problem can't quietly come back.

  4. Hand back or stay on

    You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.

Often found together

Running C# alongside something else?

We work on the whole stack, so the problem can be wherever it actually is.

Questions

C# questions

Something else? Call+1 737 727 7327

Should we upgrade from .NET Framework 4.8 to .NET 8 or 9?

If the application is actively developed and the team is big enough to do the migration safely, usually yes. Modern .NET performs better, has a smaller memory footprint, and ships with APIs the old framework never got. The decision shifts when WCF, Web Forms or a dozen native dependencies sit at the center of the code, because those need replacement rather than retargeting. We map the dependencies first and tell you honestly whether the move is weeks or months.

Why does our async C# code deadlock under load?

Almost always the mix of synchronous blocking on an async Task inside a context that only has one thread to spare. In ASP.NET on .NET Framework this is the Task.Result or Task.Wait pattern. Even in modern .NET it bites with legacy libraries that offer only sync APIs wrapped in Task.Run. The fix is to make async flow all the way down rather than blocking at the boundary.

Should we turn on nullable reference types in an older project?

Yes, in stages. A whole-codebase flip surfaces thousands of warnings and either gets reverted or papered over with suppressions. A project-by-project rollout, starting with new code and model classes, lets the team adopt the discipline without drowning in warnings. Within a quarter most mature codebases can be fully opted in.

Why are our Entity Framework queries slow?

The common causes are a LINQ query that forces client-side evaluation after a filter, missing indexes on columns used in Where or Join, lazy loading hiding N+1 patterns behind a property, and change tracking turned on when the query is read-only. We profile the generated SQL, add indexes where they help, rewrite the LINQ where EF makes a poor choice, and move the odd query to raw SQL when it earns its keep.

Can you help us finish a .NET upgrade that stalled?

Yes, this is one of the more common requests. We pick up where the previous team stopped, resolve the remaining build errors, replace the libraries that never made it across, and run the application against a staging database to prove it behaves. A half-done upgrade usually finishes in less time than teams fear, because most of the exploratory work has already been done.

How much does C# help cost?

The quote is free. Describe the solution and the symptoms, and a price lands before any work is scheduled.

Free estimate

C# project giving you trouble?

Tell us what you're running and what's going wrong. A person reads it and comes back with an estimate.

  • No charge to find out what it will take
  • If it's urgent, say so

Replies come from a person. By sending, you authorize us to email you back. No marketing.