📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Application Performance

CPU and memory optimisation, allocation reduction, async optimisation, lock contention, ThreadPool tuning, response compression, output and response caching, and object pooling in .NET 10 services.

  1. How do you invalidate output cache entries when data changes, and how do you make that work across several instances?
    Intermediate Theory Application Performance
  2. How do you approach a performance problem in a .NET service? Walk me through how you define the goal, measure, find the bottleneck, make a change and prove it helped.

    The measurement-driven method for performance work: setting a goal in percentiles and throughput, measuring a baseline, locating the bottleneck, changing one thing and verifying the result.

    Beginner Theory Application Performance Β· πŸ”— 2 follow-ups
  3. How do you tell whether a .NET service is CPU-bound, memory-bound or I/O-bound? Which dotnet-counters metrics show each, and what does the fix look like in each case?

    Classifying a slow .NET service as CPU-, memory/GC- or I/O-bound from dotnet-counters and telemetry, and the typical fix for each class.

    Intermediate Theory Application Performance Β· πŸ”— 3 follow-ups
  4. Show me how you would reduce allocations on a hot path in a .NET 10 service. Use spans, pooling, string.Create and removing LINQ and closures where they matter, and prove the improvement with BenchmarkDotNet.

    Practical allocation reduction on a hot path with Span<T>, ArrayPool<T>, string.Create and removing LINQ and closure allocations, measured with BenchmarkDotNet's MemoryDiagnoser.

    Mid-Level Coding Application Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. How do you make async code in .NET fast, not just correct? Explain when ValueTask helps, when you can avoid an async state machine, whether ConfigureAwait(false) matters in ASP.NET Core, and how you limit parallelism when fanning out I/O.

    Async performance in .NET 10: ValueTask and pooled builders, eliding the async state machine safely, the real effect of ConfigureAwait in ASP.NET Core versus libraries, and bounding concurrent fan-out.

    Mid-Level Theory Application Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. Your ASP.NET Core API's throughput stops increasing under load while CPU is only at 40%, and latency climbs. You suspect lock contention. How do you confirm it with dotnet-counters and dotnet-trace, find the contended lock, and fix it?

    Diagnosing lock contention in a .NET service with dotnet-counters (monitor-lock-contention-count), dotnet-trace contention events and dumps, then removing it with smaller critical sections, lock-free structures, sharding or immutable snapshots.

    Senior Debugging Application Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. When is it legitimate to tune the .NET ThreadPool? Explain what ThreadPool.SetMinThreads actually does, how hill climbing and starvation injection decide the thread count, and why raising thread counts often just hides sync-over-async.

    ThreadPool sizing in .NET 10: minimum threads, hill climbing, starvation-based injection, configuration options, why higher limits mask blocking code, and the narrow cases where tuning is justified.

    Senior Theory Application Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. What is the difference between response compression, output caching and response caching in ASP.NET Core? Explain what each does, how you configure it, and when each one helps or hurts performance.

    ASP.NET Core's response compression middleware, output caching (.NET 7+) and the HTTP response caching middleware: how each works, configuration, security caveats and when each improves or worsens performance.

    Intermediate Theory Application Performance Β· πŸ”— 2 follow-ups
  9. After a release, one of your services' p95 latency doubled from 180 ms to 360 ms, with no errors and no obvious change in traffic. Walk me through your end-to-end investigation and fix.

    End-to-end investigation of a latency regression after a release: mitigation, comparing before/after telemetry, narrowing to an operation and dependency, profiling, root cause, fix and prevention with performance gates.

    Senior RealWorldScenario Application Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  10. Code review: a hot-path method that runs for every incoming message chains several LINQ calls with repeated ToList(), builds a key by concatenating strings in a loop, stores values as object, and holds a lock while it writes to a database. What problems do you find, ranked by severity, and how would you rewrite it?

    Reviewing a hot path for blocking I/O under a lock, unsafe shared state, repeated LINQ materialisation, string concatenation and boxing, then rewriting it and proving the improvement with measurement.

    Senior CodeReview Application Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me