-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Throw from extension methods not supported by WebApplicationBuilder #34863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| IWebHostBuilder ISupportsStartup.UseStartup(Type startupType) | ||
| { | ||
| throw new NotSupportedException($"UseStartup() is not supported by WebApplicationBuilder.WebHost. Use the WebApplication returned by WebApplicationBuilder.Build() instead."); |
There was a problem hiding this comment.
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.
|
Also do the |
|
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:
|
f3badec to
8e3e021
Compare
|
⬆️📅 |
src/Hosting/Hosting/src/GenericHost/ISupportsConfigureWebHost.cs
Outdated
Show resolved
Hide resolved
|
Change the interface namespace. |
b04fa57 to
be2555b
Compare
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