Skip to content

Analyzer: Warn that UseStartup/Configure and ConfigureWebHost isn't supported on WebApplicationBuilder #35814

Closed
@davidfowl

Description

@davidfowl

Today we throw in the following situations:

var builder = WebApplication.CreateBuilder(args);
builder.Host.ConfigureWebHost(builder =>
{

});
var builder = WebApplication.CreateBuilder(args);

// These should all fail with errors as well
builder.WebHost.UseStartup<Startup>();
builder.WebHost.UseStartup(typeof(Startup));
builder.WebHost.UseStartup("Startup");
builder.WebHost.UseStartup(context => new Startup());
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.Configure(app =>
{

});

We should add an analyzer that detects these patterns that warns/fails and tells the user to configure the pipeline on WebApplication itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyzerIndicates an issue which is related to analyzer experiencearea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-hostingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions