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

πŸ“š .NET Interview Questions

377 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.

  1. What are linked cancellation tokens, and how do you combine a caller's token with your own timeout safely?

    CreateLinkedTokenSource, disposal to avoid leaks, telling which source fired, and combining request, shutdown and timeout cancellation.

    Senior Coding Async Advanced Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  2. How do you handle timeouts correctly in async .NET code, from HttpClient to ASP.NET Core requests?

    CancelAfter, WaitAsync, HttpClient.Timeout, resilience handlers, ASP.NET Core request timeouts middleware, TimeProvider and layered timeout budgets.

    Senior RealWorldScenario Async Advanced Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  3. What are async streams and IAsyncEnumerable of T? How do you produce, consume and cancel them?

    Async iterators with yield return and await, await foreach, EnumeratorCancellation, ConfigureAwait, LINQ over async streams in .NET 10, EF Core and ASP.NET Core streaming.

    Senior Coding Async Advanced Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. What are System.Threading.Channels, and how would you build a bounded producer/consumer pipeline with them?

    Bounded and unbounded channels, full modes, single reader and writer options, completion, ReadAllAsync and backpressure in background processing.

    Senior Coding Async Advanced Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. What is TPL Dataflow, and when would you choose it over Channels or Parallel.ForEachAsync?

    Dataflow blocks, linking with completion propagation, MaxDegreeOfParallelism, BoundedCapacity, SendAsync versus Post, batching and when it is the right tool.

    Senior Architecture Async Advanced Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  6. What is PLINQ, when does AsParallel help, and when does it make things worse?

    Parallel LINQ partitioning, degree of parallelism, ordering, merge options, cancellation, exceptions, and why it is for CPU-bound work only.

    Mid-Level Theory Async Advanced Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  7. How does Parallel.ForEachAsync work, and how does it compare with Task.WhenAll and SemaphoreSlim for concurrent I/O?

    Parallel.ForEachAsync in .NET 6+, MaxDegreeOfParallelism defaults, cancellation and exception behaviour, collecting results, Parallel.ForAsync and alternatives.

    Mid-Level Coding Async Advanced Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. A .NET service hangs with no CPU usage. How do you diagnose and fix a deadlock, whether it comes from locks or from async code?

    Deadlock conditions, lock-ordering and async deadlocks, diagnosis with dotnet-dump (syncblk, clrstack, parallelstacks, dumpasync) and prevention.

    Senior Debugging Concurrency Production Problems Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. What is a race condition? Give examples in .NET, including async and database races, and explain how you find and fix them.

    Check-then-act and read-modify-write races, non-thread-safe collections, async interleaving, lost updates in databases, and detection and fixes.

    Senior Debugging Concurrency Production Problems Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  10. How do you recognise, diagnose and fix ThreadPool starvation in a production ASP.NET Core service?

    Starvation symptoms, Kestrel heartbeat warnings, dotnet-counters and dotnet-trace evidence, dump analysis, root causes and short- versus long-term fixes.

    Senior Debugging Concurrency Production Problems Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  11. What is async-over-sync, why is wrapping synchronous code in Task.Run often a mistake, and when is it acceptable?

    Fake async wrappers, why they do not scale on servers, when offloading is right (UI responsiveness), and how to integrate blocking legacy SDKs safely.

    Senior Architecture Concurrency Production Problems Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  12. What is sync-over-async, where does it sneak into .NET code, and how do you remove it?

    Blocking on tasks with .Result, .Wait and GetResult; hidden places such as constructors, DI factories, Dispose and sync interfaces; async initialisation patterns and safe boundaries.

    Senior CodeReview Concurrency Production Problems Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  13. Which blocking calls cause problems in ASP.NET Core, how do you find them, and what should replace them?

    Synchronous I/O and AllowSynchronousIO, EF Core sync APIs, HttpClient.Send, Thread.Sleep, long locks, heavy synchronous logging; detection with analysers, traces and load tests.

    Mid-Level CodeReview Concurrency Production Problems Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  14. What is unbounded concurrency, why does it take systems down, and how do you put limits in place in .NET?

    Unbounded Task.WhenAll, Task.Run per request, unlimited queues and connections; Little's law; limits with SemaphoreSlim, Parallel.ForEachAsync, bounded channels, rate limiting middleware and bulkheads.

    Senior Architecture Concurrency Production Problems Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  15. What is backpressure, and how do you implement it across a .NET system, from in-process queues to message brokers and HTTP APIs?

    Backpressure strategies (block, buffer, drop, reject), bounded channels, pull-based streams, broker prefetch and concurrency settings, HTTP 429/503 with Retry-After, and metrics.

    Staff / Architect SystemDesign Concurrency Production Problems Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  16. What does the Single Responsibility Principle really mean, and how do you apply it in a .NET codebase without creating hundreds of tiny classes?

    SRP as one reason to change (one actor), spotting violations, splitting by change drivers, and avoiding over-fragmentation.

    Mid-Level Architecture SOLID Principles Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  17. What is the Open/Closed Principle, and how do you apply it in C# without building speculative plug-in frameworks?

    Open for extension, closed for modification; strategy, polymorphism, DI and pattern-based extension; when a switch is fine; avoiding speculative generality.

    Mid-Level Architecture SOLID Principles Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  18. Explain the Liskov Substitution Principle with a C# example of a violation, and how you would detect and fix it.

    Behavioural subtyping, preconditions, postconditions and invariants, NotSupportedException smells, the read-only collection example, and fixing hierarchies.

    Senior Architecture SOLID Principles Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  19. What is the Interface Segregation Principle, and how do you apply it to repositories, services and libraries in .NET?

    Client-specific interfaces, fat interface smells, read and write splits, role interfaces, default interface methods and avoiding interface explosion.

    Mid-Level Architecture SOLID Principles Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  20. What is the Dependency Inversion Principle, how is it different from dependency injection, and how do you apply it in a layered .NET application?

    High-level policy not depending on low-level details, abstraction ownership, DIP versus DI versus IoC containers, ports and adapters, and when not to invert.

    Senior Architecture SOLID Principles Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

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