Skip to content

Commit

Permalink
Make the plugin initialization code non cancellable (#3074)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkolev92 authored Oct 1, 2019
1 parent dc72141 commit caac282
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit caac282

Please sign in to comment.