-
Notifications
You must be signed in to change notification settings - Fork 311
Bad error when booting webhost without calling UseStartup or Configure #1137
Comments
Just hit this in testing. The error message is really misleading.
|
You will also get this exception when UseStartup is called from a HostingStartup assembly: #1140 |
I just upgraded my application to netcore2/mvc core2 and can't run it anymore. Is there any ETA on this? Or there is another way to bypass this error? |
@CheloXL can you provide repro steps on a new project that show the behavior you're seeing? The issue above is solely about the error message, it has nothing to do with functionality. The behavior should be the same as 1.1.x with respect to adding an IStartup manually. |
@davidfowl I will try to create one based on the project that I just upgrade. If I'm able to reproduce in a minimal test case, how do you want me to send the files? |
Would you be able to share it as a git repo? |
@CheloXL the issue you're likely hitting is the fact that you have to manually set the application name if you add |
@davidfowl ok, so, two things:
@JunTaoLuo yes, I already created a test case. But if @davidfowl is right (and I can setup the application name manually and it works), there should be no need for that. Waiting for (1) to try... |
.ConfigureServices(services =>
{
services.AddSingleton<IStartup, Startup>();
})
.UseSetting(WebHostDefaults.ApplicationKey, typeof(Startup).GetTypeInfo().Assembly.FullName)
This is a regression caused by this change ce650ee, we no longer fallback to the entry assembly. @anurse I think we agreed this wouldn't break anyone but it breaks this scenario. |
@davidfowl Perfect. That worked like a charm. Thanks. I would like this to be documented somewhere. I had to migrate my old authentication code and while that wasn't funny, at least it was well documented. |
@JunTaoLuo Could you file 1.0.6, 1.1.3 and 2.0.1 bugs to track this as a patch candidate? |
Patch issues added. |
@muratg Actually I think this is only a 2.0.1 patch. The original fallback was removed in 2.0.0 only. 1.1.3 and 1.0.6 are not affected. |
Thanks @JunTaoLuo. @Eilon, this is a candidate as well. |
Let's keep this as 2.1.0? I filed the patch candidate for 2.0.1 at #1177 |
@JunTaoLuo OK sounds good. |
@davidfowl The commit you linked even added a test explicitly testing this scenario; ce650ee#diff-83865cc417298cc5d089887c9a0094f9R658 |
Yes, it was never supposed to happen in the common case. Turns out if you add an IStartup to the container directly, those assumptions fall apart. |
Yep, this is the scenario where it requires a change. I remember discussing it at the time, hence the test @khellang referenced. It does look like it didn't get clearly called out in the Announcement though (aspnet/Announcements#237), which was a mistake. |
See #1023
This should have been called out more clearly in the Announcement, which is my bad. I've since updated it to help anyone searching for this issue in the future. |
Please email me patch candidates... too hard to track these on GitHub. |
@Eilon would tags help? |
Not really, because even though we have tags, people keep using them incorrectly 😄 |
The text was updated successfully, but these errors were encountered: