Skip to content
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

Regression Fix - Update HostFactoryResolver, set the app name via an argument #60053

Merged
merged 1 commit into from
Oct 7, 2021

Conversation

maryamariyan
Copy link
Member

@maryamariyan maryamariyan commented Oct 6, 2021

Based on original PR: dotnet/efcore#26198
Dupe of PR: #59743
Fixes reported issue: #59745

Updates HostFactoryResolver to account for lack of application name with new host pattern and adds test.

Description

Changes to the templates for 6.0 required a new mechanism for tools to discover and use registered services in an ASP.NET Core or any other app based on a hosted service provider. This new mechanism results in a host setup that does not by default have an application name available. This in turn results in user secrets not being found, and so any tooling that is using user secrets will fail. This was discovered using EF Core which supports obtaining the database connection string from user secrets.

The fix is to set a default application name based on the assembly when using this new mechanism to discover services.

Customer impact

EF Core database operations executed from the command line may fail, or worse, use the wrong connection string and update the wrong database.

How found

Customer reported on RC1.

Regression

Yes and no. It's a regression to the experience when the new templates or the patterns shipped in those templates are used. It is not technically a regression if the application is still using the patterns from previous versions.

Testing

Testing is tricky here because this runtime package is consumed as source in EF Core. This is what we have done and plan to do:

  • We have manually tested end-to-end with EF Core by including the updated source in an EF Core local build.
  • We have added unit tests as part of this PR.
  • We have unit tests in EF Core that will validate that the change flows into EF Core correctly. See [6.0] Test changes to make sure applicationName is set when using new template pattern efcore#26204.
  • Once the change has made its way into EF Core, we will test again end-to-end using a daily build of the EF Core GA package.
  • We will do a final end-to-end test once the GA build for validation is available.

Risk

Low. Simple code change to add a default application name on in the new code path introduced in 6.0.

@ghost
Copy link

ghost commented Oct 6, 2021

Tagging subscribers to this area: @eerhardt, @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

Based on original PR: dotnet/efcore#26198
Dupe of PR: #59743
Fixes reported issue: #59745

Updates HostFactoryResolver to account for lack of application name with new host pattern and adds test.

Author: maryamariyan
Assignees: -
Labels:

area-Extensions-Hosting

Milestone: -

@ajcvickers
Copy link
Member

Thanks @maryamariyan. This will also need to go into 6.0 GA after approval.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM.

I assume someone has verified this fixes the end-to-end scenario pointed out in the bug.

@ajcvickers
Copy link
Member

@eerhardt See Tactics template above for testing plan.

@eerhardt
Copy link
Member

eerhardt commented Oct 7, 2021

@ajcvickers - Perfect! Thanks.

@maryamariyan maryamariyan merged commit 00fcaa1 into dotnet:main Oct 7, 2021
@ericstj
Copy link
Member

ericstj commented Oct 7, 2021

/backport to release/6.0

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2021

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1317363901

@ghost ghost locked as resolved and limited conversation to collaborators Nov 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants