Use async service provider in ServiceLocator - #2898
Merged
Merged
Conversation
nkolev92
force-pushed
the
dev-nkolev92-useAsyncServiceProvider
branch
from
June 21, 2019 00:14
f3ed7fd to
49c34e7
Compare
nkolev92
requested review from
dominoFire,
donnie-msft,
dtivel,
heng-liu and
zivkan
June 21, 2019 01:00
nkolev92
marked this pull request as ready for review
June 21, 2019 01:01
zivkan
approved these changes
Jun 21, 2019
dtivel
reviewed
Jun 21, 2019
nkolev92
force-pushed
the
dev-nkolev92-useAsyncServiceProvider
branch
from
June 24, 2019 17:50
5dbba5f to
a1f98b3
Compare
Member
Author
|
@dtivel this is ready for another review. |
nkolev92
force-pushed
the
dev-nkolev92-useAsyncServiceProvider
branch
from
June 27, 2019 19:37
1b1b2df to
f6df873
Compare
dtivel
approved these changes
Jun 27, 2019
| } | ||
| } | ||
|
|
||
| return Package.GetGlobalService(typeof(TService)) as TInterface; |
Contributor
There was a problem hiding this comment.
Should we add telemetry for when this or this is called?
Member
Author
There was a problem hiding this comment.
What would be trying to learn?
It would just tell us that the service in question is not async.
Maybe something else?
Member
Author
There was a problem hiding this comment.
I'll merge this now, so it can runt through the nightly validations, but i'll be hpapy to discuss further improvements to this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Fixes: 899473
Regression: No
Fix
Details:
From the issue:
GetComponentModelServiceAsync which actually just switches to the UI thread and then calls GetService. This is REALLY bad for MEF which can be very expensive to initialize. NuGet needs to use the async service provider which is MUCH smarter about only switching if needed, ensuring packages that need to be loaded and can be loaded off the UI thread are, etc...
The NuGetPackage is already async and we use the IAsyncServiceProvider in some other related codepaths.
#2163 & #2179
@dtivel This is the change that would conflict with the change in your PR.
Testing/Validation
Tests Added: No
Reason for not adding tests: Threading changes
Validation: