DEV Community

Cover image for Core .NET concepts you must nail in a senior interview
Libin Tom Baby
Libin Tom Baby

Posted on

Core .NET concepts you must nail in a senior interview

Core .NET concepts you must nail in a senior interview


1. How do .NET Framework and .NET Core differ in async programming?

.NET Framework captures the SynchronizationContext, especially in UI apps. This can cause deadlocks if you block with .Result or .Wait().

.NET Core avoids context capture in server apps, making async/await more scalable and less prone to deadlocks.

// .NET Core - safe async
await httpClient.GetAsync("https://api.com");
Enter fullscreen mode Exit fullscreen mode

Use ConfigureAwait(false) in library code to avoid unnecessary context capture.


2. What’s the difference between Startup.cs and Program.cs?

In .NET Core:

  • Program.cs is the entry point. It builds the host.
  • Startup.cs configures services and middleware.

In .NET 6+, they’re merged:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
var app = builder.Build();
app.MapControllers();
app.Run();
Enter fullscreen mode Exit fullscreen mode

Use separate files for large apps to maintain clarity and separation of concerns.


3. How do you explain cookies to a non-technical stakeholder?

Cookies are like name tags websites give you. They help the site remember who you are—like keeping you logged in or remembering your preferences. They’re stored on your device and sent back to the site automatically.


4. How does a developer access cookie values from the server?

var theme = Request.Cookies["UserTheme"];
if (theme != null) {
    return Content($"Theme: {theme}");
}
Enter fullscreen mode Exit fullscreen mode

Always check for null. Use HttpOnly and Secure flags for sensitive data.


5. How do you debug intermittent site crashes?

You don’t guess—you capture, analyze, and isolate.

  1. Capture: Enable crash dumps, use Application Insights, Serilog, or ELK.
  2. Analyze: Look for memory leaks, thread starvation, unhandled exceptions.
  3. Diagnose: Attach Visual Studio or dotTrace.
  4. Fix: Refactor blocking calls, add retries, validate with load tests.

Use correlation IDs and structured logging to trace across services.


6. What encoding does .NET use by default?

  • .NET Core: UTF-8
  • .NET Framework: System-dependent ANSI

Always specify encoding explicitly:

File.WriteAllText("data.txt", content, Encoding.UTF8);
Enter fullscreen mode Exit fullscreen mode

This avoids corruption and ensures cross-platform consistency.

Top comments (0)