Skip to content

Conversation

@halter73
Copy link
Member

@halter73 halter73 commented Jul 30, 2021

WebApplicationBuilder.WebHost.UseStartup/Configure no-op today. This makes it clear that they don't work.

This now also causes WebApplicationBuilder.Host.ConfigureWebHost/ConfigureWebHostDefaults to throw for similar reasons.

Fixes #34824


IWebHostBuilder ISupportsStartup.UseStartup(Type startupType)
{
throw new NotSupportedException($"UseStartup() is not supported by WebApplicationBuilder.WebHost. Use the WebApplication returned by WebApplicationBuilder.Build() instead.");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these messages probably need work. Someone could also be interested in modifying services with the startup class, and for that they want to use WebApplicationBuilder.Services instead of WebApplication's IApplicationBuilder implementation. I didn't want this to get too wordy though.

@davidfowl
Copy link
Member

davidfowl commented Jul 30, 2021

Also do the builder.Host.ConfigureWebHost as part of this change?

@halter73 halter73 changed the title Throw from WebApplicationBuilder.WebHost.UseStartup/Configure Throw from extension methods not supported by WebApplicationBuilder Jul 31, 2021
@davidfowl davidfowl added the api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews label Jul 31, 2021
@ghost
Copy link

ghost commented Jul 31, 2021

Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:

  • The PR contains changes to the reference-assembly that describe the API change. Or, you have included a snippet of reference-assembly-style code that illustrates the API change.
  • The PR describes the impact to users, both positive (useful new APIs) and negative (breaking changes).
  • Someone is assigned to "champion" this change in the meeting, and they understand the impact and design of the change.

@halter73 halter73 force-pushed the halter73/34824 branch 2 times, most recently from f3badec to 8e3e021 Compare August 4, 2021 16:49
@halter73
Copy link
Member Author

halter73 commented Aug 4, 2021

⬆️📅

@davidfowl
Copy link
Member

Change the interface namespace.

@halter73 halter73 enabled auto-merge (squash) August 4, 2021 21:20
@halter73 halter73 merged commit 545d4ee into main Aug 5, 2021
@halter73 halter73 deleted the halter73/34824 branch August 5, 2021 04:28
@halter73 halter73 restored the halter73/34824 branch August 6, 2021 21:10
@halter73 halter73 deleted the halter73/34824 branch August 6, 2021 21:10
@davidfowl davidfowl added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews labels Aug 8, 2021
@amcasey amcasey added area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed area-runtime labels Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-approved API was approved in API review, it can be implemented area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-minimal-hosting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ISupportsConfigureWebHost interface to hosting.

5 participants