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

Phase 23 — Code Quality

Writing and keeping .NET code maintainable: clean code, refactoring techniques, code smells, static analysis with Roslyn analysers and SonarQube, and the engineering practices (reviews, ADRs, tech debt, definition of done) that keep a codebase healthy.

  1. Your build has 40 analyser warnings and the team ignores them. Should you turn on TreatWarningsAsErrors tomorrow?
    Junior Theory Static Analysis
  2. Coverage on new code keeps failing the gate for DTO and EF Core migration files. What do you do?
    Intermediate Theory Static Analysis
  3. Your custom analyser works in Rider for one developer but does nothing for another on an older SDK. Why, and how do you fix it?
    Mid-Level Coding Static Analysis
  4. What is static analysis, and what does it catch that your unit tests don't? Name the main static analysis tools a .NET team uses and where each one runs.

    Covers what static analysis is, the kinds of defects it finds that tests miss, and the main .NET tools (compiler and nullable warnings, .NET SDK CA/IDE analysers, StyleCop, SonarAnalyzer, Roslynator, BannedApiAnalyzers, CodeQL) and where they run.

    Junior Theory Static Analysis Β· πŸ”— 3 follow-ups
  5. How does SonarQube (or SonarQube Cloud) fit into a .NET team's pipeline? Explain quality gates, the 'new code' focus, which edition you need for pull request analysis, and how you stop the team from gaming the metrics.

    Covers how SonarQube Server and SonarQube Cloud analyse .NET code with the scanner, how quality gates and the new-code period work, edition differences for branch and pull request analysis, coverage import, and how to avoid metric gaming.

    Intermediate Theory Static Analysis Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. Which security analysers would you run on a .NET 10 codebase in CI, and what does each kind find? Compare Roslyn security rules, CodeQL and SonarQube security analysis, secret scanning and dependency scanning, and explain how you triage false positives without letting real findings slip through.

    Covers the layers of automated security analysis for .NET (CA security rules, CodeQL taint analysis, Sonar vulnerabilities and hotspots, secret scanning, NuGetAudit and Dependabot), what each catches and misses, severity policy in CI, and a disciplined false-positive triage process.

    Mid-Level Theory Static Analysis Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. Your team keeps breaking a rule: money values must be decimal, never double. Write a small custom Roslyn analyser that enforces it, with a test. How do you package it for the team, and when would a banned-API list or an existing analyser be the better choice?

    Covers writing a custom Roslyn DiagnosticAnalyzer for a team rule (money must be decimal), the project setup (netstandard2.0, EnforceExtendedAnalyzerRules), symbol actions, testing with Microsoft.CodeAnalysis.Testing, shipping via project reference or NuGet, performance rules, and when BannedApiAnalyzers or existing rules are better.

    Mid-Level Coding Static Analysis Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. You join a team whose main .NET solution builds with about 5,000 compiler and analyser warnings, and nobody reads them any more. You're asked to make static analysis useful again without stopping feature delivery. Walk me through what you would do in the first weeks and how you would keep it from sliding back.

    Covers a real rollout plan for analysers on a legacy .NET solution with thousands of warnings: measuring and grouping warnings, deciding per rule (fix, enforce, or switch off), mechanical bulk fixes, a ratchet so the count can only fall, per-project warnings-as-errors, team agreement and progress tracking.

    Senior RealWorldScenario Static Analysis Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. What makes a good pull request? Talk me through size, the description, tests and self-review, and why each one matters to the people reviewing it.

    Covers the four habits of a reviewable pull request: small focused size, a description that explains why, tests that prove the change, and a self-review before asking anyone else.

    Junior Theory Engineering Practice Β· πŸ”— 3 follow-ups
  10. How do you give and receive code review well? What do you actually look for in a review, how do you word comments so they help rather than hurt, and how do you separate blocking issues from suggestions?

    Covers what a reviewer checks (correctness, design, tests, security, readability), how to write kind and specific comments, labelling blocking versus non-blocking feedback, and how to receive review without defensiveness.

    Intermediate Theory Engineering Practice Β· πŸ”— 2 follow-ups
  11. What is an architecture decision record? What format do you use, which decisions deserve one, and how do you keep a set of ADRs useful instead of letting them become a folder nobody reads?

    Covers what an ADR is, the Nygard format (context, decision, status, consequences), which decisions warrant one, where to store them, superseding instead of editing, and keeping them discoverable and current.

    Mid-Level Theory Engineering Practice Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  12. How do you run a technical debt register on a .NET team? What goes in each entry, how do you use cost of delay to prioritise the items, and how do you make the case to a product owner who only sees features?

    Covers what a technical debt register is, the fields each entry needs (impact, interest, effort, owner), prioritising with cost of delay and WSJF, capacity models for paying debt down, and framing debt in business terms for product owners.

    Mid-Level Theory Engineering Practice Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  13. When does a change need a design document rather than just a ticket and a pull request? What goes into a good design doc, and how do you get it reviewed without it turning into weeks of debate?

    Covers when a design document is worth writing, the sections of a good one (context, goals and non-goals, proposal, alternatives, risks, rollout), keeping it short, running a time-boxed review, and turning outcomes into ADRs.

    Mid-Level Theory Engineering Practice Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  14. A teammate's pull requests keep getting rejected or sent back for several rounds of changes, and they're visibly frustrated. Some reviewers are frustrated too. As a senior engineer, how do you handle it?

    Covers diagnosing why one developer's PRs keep failing review (unclear expectations, PR size, skill gaps, reviewer behaviour), the private conversation, pairing and early feedback, fixing team-level review norms, and measuring improvement.

    Senior Behavioral Engineering Practice Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  15. Design a definition of done for a .NET product team that actually raises quality without slowing delivery. What goes in it, what do you automate versus check by hand, how does it differ for different kinds of work, and how do you stop it becoming a box-ticking exercise?

    Covers designing a team definition of done: quality criteria (tests, review, analysers, security, observability, docs, deployed to production), automating checks in CI and branch policies, keeping it short, tailoring by work type, and evolving it with retros and metrics.

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

🌐 Sangam's Webring

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