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.
How ASP.NET Core on .NET 10 hosts, routes and handles requests: Kestrel and hosting, the middleware pipeline, Minimal APIs and MVC, configuration and options, logging, OpenAPI, and real-time and background services.
Code review of a typical problematic controller: catch-all returning 200 with exception messages (information disclosure, broken HTTP semantics, swallowed errors), over-posting by binding EF entities, mass assignment of sensitive fields, hand-rolled validation, sync-over-async and missing cancellation, and a rewrite with request DTOs, validation, ProblemDetails, proper status codes and global exception handling.
A real-world migration of ASP.NET Core configuration to Azure Key Vault and Azure App Configuration with managed identity: inventory and classification, RBAC roles, AddAzureKeyVault versus App Configuration Key Vault references, labels per environment, sentinel-key refresh and Key Vault reload intervals, rotation with overlapping secret versions, passwordless Entra ID auth, start-up resilience and replicas, feature flags with Microsoft.FeatureManagement, and the rollout plan.
The ASP.NET Core configuration system: IConfiguration as a merged key-value view over ordered providers, the default sources added by WebApplication.CreateBuilder, last-provider-wins precedence, case-insensitive hierarchical keys with colon, double underscore for environment variables, array indexes and reading values with GetValue, GetSection and GetConnectionString.
ASP.NET Core environments: how the environment name is resolved (ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, --environment, default Production), IHostEnvironment and IsDevelopment/IsProduction/IsEnvironment, what changes in Development (developer exception page, user secrets, DI validation), appsettings.{Environment}.json selection, launchSettings.json, and what belongs outside appsettings.
The .NET Secret Manager: UserSecretsId in the project file, dotnet user-secrets init/set/list, the secrets.json location on Windows, Linux and macOS, loading only in the Development environment, why it is plain text outside the repo rather than encryption, and production replacements such as Azure Key Vault with managed identity and platform secret stores.
The options pattern: binding configuration sections to strongly typed classes with Configure<T>, AddOptions<T>().Bind/BindConfiguration, how ConfigurationBinder maps keys to properties (case-insensitive, conversions, collections, missing keys, ErrorOnUnknownConfiguration), IConfigureOptions and PostConfigure for code-based setup, the binding source generator for AOT, and why injecting IConfiguration into services is an anti-pattern.
IOptions, IOptionsSnapshot and IOptionsMonitor compared: singleton, scoped and singleton lifetimes, computed once versus per scope versus cached and rebuilt on change tokens, CurrentValue and OnChange, named options with Get(name), the captive-dependency error, the per-request rebinding cost of IOptionsSnapshot, and how to choose for singletons, request handlers and BackgroundService.
Options validation in ASP.NET Core: ValidateDataAnnotations and its reflection cost, Validate delegates, IValidateOptions<T> for cross-property and service-dependent rules, ValidateOnStart to fail at host start-up, ValidateObjectMembers and ValidateEnumeratedItems for nested types, the compile-time [OptionsValidator] source generator for AOT, OptionsValidationException behaviour on reload, and testing validators.
Diagnosing configuration values that don't take effect in Azure App Service, Container Apps or Kubernetes: environment variable naming (: versus __, ConfigMap key rules, App Service connection string prefixes), provider order and custom sources added last, the wrong environment name, values read once at start-up, mounted ConfigMap symlink swaps and DOTNET_USE_POLLING_FILE_WATCHER, and using GetDebugView with masking, the provider list, printenv and az CLI to find which provider won.
Code review of configuration anti-patterns: secrets committed in appsettings.json (incident response, rotation, history, Privacy Act and NDB), constructors that parse configuration and open connections, a static IConfiguration singleton (hidden dependencies, test pollution, no reload), no validation, and the rewrite with options classes, ValidateOnStart, Key Vault with managed identity and passwordless SQL, plus blocking versus suggested review comments and secret scanning.
ILogger<T> basics: the six log levels plus None, categories derived from the type name, the Logging:LogLevel section in appsettings.json, per-provider overrides, most-specific-prefix matching and the default levels in the ASP.NET Core templates.
Logging providers in Microsoft.Extensions.Logging: the defaults added by WebApplication.CreateBuilder (Console, Debug, EventSource, EventLog on Windows), adding OpenTelemetry or Azure Monitor, ClearProviders, how ILoggerFactory fans a call out to one ILogger per provider with per-provider filtering, console formatters and the cost of synchronous providers.
Structured logging in .NET: message templates with named placeholders, how LogValues keeps the template and arguments separately, why $"..." interpolation destroys properties and allocates even when filtered (CA2254), the @ and $ destructuring hints in Serilog, KQL queries over customDimensions, cardinality and naming conventions.
High-performance logging: the cost of LoggerExtensions calls (params object[] allocation, boxing, template parsing), the [LoggerMessage] source generator on partial methods, generated IsEnabled checks and cached delegates, CA1848, guarding expensive arguments with IsEnabled, and a BenchmarkDotNet comparison with MemoryDiagnoser.
Comparing logging stacks for ASP.NET Core on .NET 10: Serilog (AddSerilog, two-stage bootstrap, sinks, enrichers, Serilog.Settings.Configuration), NLog (UseNLog, targets, layouts, nlog.config), and the built-in abstraction with OpenTelemetry exporters; how each sits behind ILogger, what OpenTelemetry changes, and a decision guide.
Log scopes and correlation in ASP.NET Core: ILogger.BeginScope and scope providers, the hosting scope (RequestId, RequestPath), ActivityTrackingOptions adding TraceId and SpanId, System.Diagnostics.Activity and AsyncLocal flow, W3C Trace Context (traceparent, tracestate, baggage), automatic propagation through HttpClient, propagating through Azure Service Bus messages, and when a business correlation ID is still useful.
OpenTelemetry in ASP.NET Core on .NET 10: the three signals and how logs carry TraceId/SpanId, AddOpenTelemetry with WithTracing, WithMetrics and WithLogging, resource attributes, built-in ASP.NET Core and HttpClient instrumentation and meters, UseOtlpExporter vs the Azure Monitor distro (UseAzureMonitor, rate-limited sampling default since 1.5), head versus tail sampling in the Collector, and cost control.
Secure logging: what counts as secrets and personal information, why logs are a breach surface, Microsoft.Extensions.Compliance.Redaction (data classification attributes, AddRedaction, EnableRedaction, erasing and HMAC redactors, [LogProperties]), safe HTTP logging and header allowlists, scanning and testing for leaks, and Australian Privacy Act APP 11, APP 11.2 retention and the Notifiable Data Breaches scheme.
A real-world logging cost and latency incident: finding ingestion sources with KQL over _BilledSize by table, category and template, common causes (Debug left on, EF Core command logging, HTTP body logging, duplicate pipelines, health-check noise, disabled sampling), latency from synchronous or blocked log writes, fixes in levels, filters, sampling and sinks, and long-term controls such as daily caps, table plans, transformations and cost alerts.
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.