Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Created October 25, 2025 14:27
Show Gist options
  • Select an option

  • Save wullemsb/f6cfc29ea2efa9e6c529e7d55fe6a311 to your computer and use it in GitHub Desktop.

Select an option

Save wullemsb/f6cfc29ea2efa9e6c529e7d55fe6a311 to your computer and use it in GitHub Desktop.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<OrderService>();
// Still forgot IPaymentProcessor...
// Enable validation
builder.Host.UseServiceProviderFactory(new ServiceProviderFactory(
new ServiceProviderOptions
{
ValidateOnBuild = true
}));
var app = builder.Build(); // Throws exception here!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment