From 96b56eae03f8afb05aeb6a6041ed9e6e056864df Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Mon, 11 Oct 2021 11:47:24 -0700 Subject: [PATCH] Retry on analyzer reference assembly failure (#889) --- .../LooseAssembly.NuGet/LooseAssembly.NuGet.csproj | 2 +- ...UpgradeAssistant.Extensions.Default.Analyzers.Test.csproj | 1 + .../TestHelper.cs | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/extensions/looseassembly/LooseAssembly.NuGet/LooseAssembly.NuGet.csproj b/src/extensions/looseassembly/LooseAssembly.NuGet/LooseAssembly.NuGet.csproj index ff42bc41..c5c8d828 100644 --- a/src/extensions/looseassembly/LooseAssembly.NuGet/LooseAssembly.NuGet.csproj +++ b/src/extensions/looseassembly/LooseAssembly.NuGet/LooseAssembly.NuGet.csproj @@ -20,7 +20,7 @@ $(BlobBase)$(IndexName) - + diff --git a/tests/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test.csproj b/tests/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test.csproj index b27a426e..8fffcde9 100644 --- a/tests/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test.csproj +++ b/tests/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test.csproj @@ -48,6 +48,7 @@ 1.0.1-beta1.21265.1 + diff --git a/tests/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test/TestHelper.cs b/tests/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test/TestHelper.cs index 4ead7a2d..e4c078e0 100644 --- a/tests/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test/TestHelper.cs +++ b/tests/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test/TestHelper.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; using Microsoft.DotNet.UpgradeAssistant.Extensions.Default.CodeFixes; using Microsoft.DotNet.UpgradeAssistant.Steps.Source; +using Polly; using Xunit; namespace Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test @@ -82,7 +83,9 @@ namespace Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers.Test } } - var references = await GetReferenceAssemblies().ResolveAsync(language.ToLanguageName(), cancellationToken); + var references = await Policy.Handle() + .RetryAsync(3) + .ExecuteAsync(cancellationToken => GetReferenceAssemblies().ResolveAsync(language.ToLanguageName(), cancellationToken), cancellationToken); project = project.WithMetadataReferences(references);