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

API Features

OpenAPI, Swagger, API Explorer, the built-in OpenAPI support, build-time OpenAPI generation and endpoint metadata.

  1. Your OpenAPI document is wrong: some endpoints are missing, responses have no schema, polymorphic types show only the base class, enums appear as integers and nullability is wrong. How do you diagnose and fix it?

    Debugging question on a wrong or incomplete OpenAPI document in ASP.NET Core: endpoints missing from API Explorer, untyped IResult responses, JsonPolymorphic and JsonDerivedType for oneOf, enum converters, nullable and required properties, and a snapshot test to keep it right.

    Mid-Level Debugging API Features Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  2. Should Swagger UI or the OpenAPI document be exposed in production? Explain the risks, how you would secure or environment-gate the docs, and when a public document is the right call.

    Security question on publishing OpenAPI documents and Swagger UI or Scalar in production: reconnaissance risk, leaked internal and admin endpoints, examples containing personal data, UI vulnerabilities and OAuth client settings, and the controls (environment gating, RequireAuthorization on MapOpenApi, separate public documents, API Management developer portals) plus when a public document is the right call.

    Senior Security API Features Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  3. How do endpoint metadata and API Explorer work in ASP.NET Core? Explain WithName, WithTags, Produces, ProducesProblem and TypedResults, and how the same metadata drives the OpenAPI document, link generation and authorisation.

    Theory question on the endpoint metadata collection and IApiDescriptionGroupCollectionProvider: how WithName, WithTags, WithSummary, Produces, ProducesProblem, Accepts, ExcludeFromDescription, IEndpointMetadataProvider on TypedResults and attributes become metadata, and how OpenAPI, LinkGenerator, authorisation, CORS and rate limiting all read from it.

    Mid-Level Theory API Features Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. How do you generate the OpenAPI document at build time in ASP.NET Core with Microsoft.Extensions.ApiDescription.Server? Should you commit the spec, and how do you generate C# or TypeScript clients from it with Kiota or NSwag?

    Theory question on generating the OpenAPI document during dotnet build with Microsoft.Extensions.ApiDescription.Server (OpenApiGenerateDocuments, OpenApiDocumentsDirectory, OpenApiGenerateDocumentsOptions, the GetDocument.Insider entry point), whether to commit the spec, and generating C# and TypeScript clients from it with Kiota or NSwag.

    Mid-Level Theory API Features Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  5. How would you use the OpenAPI document as a contract in CI? Explain how you detect breaking changes between versions with a tool like oasdiff, lint the spec, and manage separate documents for each major API version.

    Architecture question on contract-as-code for ASP.NET Core APIs: a committed build-time spec, breaking-change detection with oasdiff against main and released versions, Spectral linting, one OpenAPI document per major version with Asp.Versioning or group names, and how this fits with consumer-driven contract tests.

    Senior Architecture API Features Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  6. What is the difference between OpenAPI and Swagger? Explain why the .NET 9+ web API templates no longer ship Swashbuckle, how the built-in Microsoft.AspNetCore.OpenApi package compares with Swashbuckle and NSwag, and what Swagger UI and Scalar actually do.

    Theory question separating the OpenAPI specification from the Swagger tooling brand, the move from Swashbuckle to Microsoft.AspNetCore.OpenApi in the .NET 9+ templates, how the three document generators compare, and the role of UI viewers such as Swagger UI and Scalar.

    Junior Theory API Features Β· πŸ”— 3 follow-ups
  7. Show me how you configure the built-in OpenAPI support in .NET 10. Use AddOpenApi and MapOpenApi, write document, operation and schema transformers, add a JWT bearer security scheme, and explain what changed when the default moved to OpenAPI 3.1.

    Coding question on Microsoft.AspNetCore.OpenApi in .NET 10: registering and mapping documents, the three transformer types, adding a bearer security scheme and requirements, XML comments, and the OpenAPI 3.1 and Microsoft.OpenApi 2.x changes.

    Intermediate Coding API Features Β· πŸ”— 2 follow-ups

🌐 Sangam's Webring

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