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

Tasks

Task, Task of T, ValueTask, async and await, the state machine, task schedulers, continuations, exceptions and fire-and-forget.

  1. What is a Task in .NET? Is a Task the same as a thread?

    Task as a promise of completion, delegate tasks versus promise tasks, TaskStatus, and the core combinators in .NET 10.

    Mid-Level Theory Tasks Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  2. How does Task of T differ from Task, and what should you know about getting its result safely?

    `Task<T>` results, await versus .Result versus GetAwaiter().GetResult(), TaskCompletionSource of T, cached completed tasks and why `Task<T>` is not covariant.

    Mid-Level Theory Tasks Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  3. What is ValueTask, when should you use it instead of Task, and what rules must callers follow?

    ValueTask and `ValueTask<T>`: allocation-free synchronous completion, IValueTaskSource pooling, consumption rules and when Task is still the better choice.

    Senior Theory Tasks Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. What do the async and await keywords actually do? Explain what happens when execution reaches an await.

    The async modifier, the awaitable pattern, the IsCompleted fast path, continuation registration, context capture and valid async return types.

    Mid-Level Theory Tasks Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. What does the compiler generate for an async method? Explain the async state machine.

    IAsyncStateMachine, MoveNext, the state field, hoisted locals, the method builder, boxing on first suspension and the cost model of async in .NET 10.

    Senior Theory Tasks Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. What is a TaskScheduler, and what is the difference between TaskScheduler.Default and TaskScheduler.Current?

    TaskScheduler responsibilities, the default ThreadPool scheduler, Current versus Default pitfalls with StartNew and ContinueWith, FromCurrentSynchronizationContext and ConcurrentExclusiveSchedulerPair.

    Senior Theory Tasks Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  7. What are task continuations? Compare ContinueWith with await and explain the options that control how continuations run.

    ContinueWith, TaskContinuationOptions, synchronous versus asynchronous continuations, RunContinuationsAsynchronously, Unwrap and why await is usually better.

    Senior Theory Tasks Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. How are exceptions handled in tasks and async methods? What happens with Task.WhenAll, unobserved exceptions and async void?

    Exceptions stored in tasks, AggregateException versus await, WhenAll with several failures, cancellation status, UnobservedTaskException and async void crashes.

    Senior Debugging Tasks Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. What are the risks of fire-and-forget tasks in .NET, and how would you run background work safely in ASP.NET Core?

    Lost exceptions, disposed scoped services, lost work on shutdown, no backpressure; safe alternatives with BackgroundService, Channel of T and durable queues.

    Senior RealWorldScenario Tasks Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

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