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

Data Consistency

Sagas, outbox and inbox, distributed transactions and two-phase commit, event sourcing, event replay and event versioning for keeping data consistent across services.

  1. Why do cloud systems avoid distributed transactions and two-phase commit? Explain how 2PC works, where it breaks (blocking, in-doubt transactions, availability, locks across the network), what .NET 10 and Azure still support, and what you use instead to keep data consistent across services.

    Two-phase commit and distributed transactions: the prepare and commit protocol, its blocking and availability failure modes, current .NET and Azure support (MSDTC on Windows only, elastic transactions, no broker enlistment), and the replacements: one transaction by design, outbox with idempotent consumers, sagas, reservations and reconciliation.

    Mid-Level Theory Data Consistency Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  2. Your event-sourced system needs a new read model, and an existing projection has a bug that corrupted its data. How do you replay events to rebuild projections? Explain checkpoints, rebuilding side by side and switching over, what happens to side effects such as emails and integration events during a replay, and why handlers must be idempotent.

    Event replay in event-sourced and event-driven systems: rebuilding projections from the event store or a retained log, checkpoints and positions, blue-green projection rebuilds, separating projections from side-effect handlers, idempotent and deterministic handlers, and replay speed and ordering.

    Senior Theory Data Consistency Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  3. Events are stored for years and read by consumers you don't control, but the event shapes keep changing. How do you version events? Explain additive (weak-schema) changes, upcasting old events when they are read, new event types for breaking changes, schema registries and their compatibility modes, and how you keep old consumers working during a rollout.

    Event versioning for event stores and integration events: weak-schema tolerant readers, upcasting chains at read time, new event types and parallel publishing for breaking changes, copy-and-transform migrations, schema registries (Confluent, Azure Schema Registry) with backward, forward and full compatibility, and System.Text.Json behaviour.

    Senior Theory Data Consistency Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. A business process spans several steps and services. How do you decide between keeping it in one service with one database transaction, using an outbox with eventual consistency, and building a saga with compensations? Walk me through the questions you ask, the trade-offs, and an example of each choice.

    Choosing a consistency mechanism for a multi-step process: when to keep data in one service and one transaction, when an outbox with idempotent consumers and eventual consistency is enough, and when a saga (orchestrated or choreographed) with compensations and timeouts is needed, plus reservations, the UX of pending states and the operating cost.

    Senior Architecture Data Consistency Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. A customer complains that $2,000 left their account in the Accounts service, but the transfer never arrived in the Payments service and nothing is in progress. Support finds dozens of similar cases from the last week. How do you trace the inconsistency across services, contain it, repair the data safely, and stop it happening again?

    A real-world cross-service money inconsistency: tracing a transfer by correlation id through the ledger, outbox, broker, dead-letter queues, inbox and saga state; containing the damage; repairing with idempotent, audited compensating or completing commands driven by a reconciliation report; and preventing recurrence with reconciliation, outbox-age and DLQ alerts.

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

🌐 Sangam's Webring

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