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

Make the plugin initialization code non cancellable #3074

Merged
merged 2 commits into from
Oct 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/NuGet.Core/NuGet.Protocol/Plugins/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ private async Task<Tuple<bool, PluginCreationResult>> TryCreatePluginAsync(
JObject serviceIndex,
CancellationToken cancellationToken)
{
// This is a non cancellable task.
// We should only honor cancellation requests we can recover from.
// Once we have reached this part of the code, we do the plugin initialization
// handshake, operation claims, and shut down set up.
// If either one of these tasks fails then the plugin itself is not usable for the rest of the process.
// We could consider handling each of this operations more cleverly,
// but simplicity and readability is prioritized
cancellationToken = CancellationToken.None;
PluginCreationResult pluginCreationResult = null;
var cacheEntry = new PluginCacheEntry(_pluginsCacheDirectoryPath.Value, result.PluginFile.Path, requestKey.PackageSourceRepository);

Expand Down