This repository was archived by the owner on Apr 12, 2021. It is now read-only.
Added VS.Initialize and VS.JoinableTaskFactory #24
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.
VS.Initialize
is a new, optional method that extension authors can (preferably should) call during their AsyncPackage's InitializeAsync, and pass in their AsyncPackage's JoinableTaskFactory instance.By default, the
VS.JoinableTaskFactory
property returns theThreadHelper.JoinableTaskFactory
instance.But if the extension calls VS.Initialize then
VS.JoinableTaskFactory
will subsequently return the extension AsyncPackage's JTF instance.Classes in the Community.VisualStudio.Toolkit should use
VS.JoinableTaskFactory.RunAsync
instead ofThreadHelper.JoinableTaskFactory.RunAsync
for the reasons outlined in #7As a result, if an extension uses the Community.VisualStudio.Toolkit and chooses to call VS.Initialize then it will benefit from the task tracking that occurs with their extension package's JTF instance, because all async work started by the Toolkit will use their extension's JTF instance.