Code QuizIntermediate

WebApplication.CreateBuilder and the unified Program.cs startup

A minimal API startup that registers a service in the wrong place relative to the builder's Build call.

Codecsharp
var builder = WebApplication.CreateBuilder(args);

var app = builder.Build();

builder.Services.AddSingleton<IClock, SystemClock>();

app.MapGet("/now", (IClock clock) => clock.UtcNow);

app.Run();

What is the bug in this code?