dotnet / upgrade-assistant

A tool to assist developers in upgrading .NET Framework applications to .NET 6 and beyond
MIT License
1.1k stars 163 forks source link

Maximum package analysis and update iterations reached. #904

Closed lunchin closed 1 month ago

lunchin commented 2 years ago

Review NuGet dependencies manually [09:28:58 WRN] Upgrade step Clean up NuGet package references failed: Failed: Maximum package analysis and update iterations reached Command (Apply next step (Clean up NuGet package references)) did not succeed upgrade-assistant.clef.zip

georgikoemdzhiev commented 2 years ago

Getting the same issue on the latest version of the assistant - 0.3.252501+d008dcd65150d4d24cdeb8378cc517cc5b121b2f

mjrousos commented 2 years ago

This looks like a bug in our Package Updater step. Are you able to share the csproj and packages.config file so I can try to reproduce it?

JoakimHLund commented 2 years ago

This happens both in the "Clean up NuGet package references" and in the "Update NuGet package references" step.

I am unable to share csproj and package files for privacy reasons, but the following is added repeatedly to the csproj file:

<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.3.252501">
    <PrivateAssets>all</PrivateAssets>
</PackageReference>
VanjaPopovic commented 2 years ago

Having the same issue, it keeps adding

<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.3.252501">
    <PrivateAssets>all</PrivateAssets>
</PackageReference>

and then fails.

marijorg commented 2 years ago

Any updates on this one?

During upgrade of our solution using upgrade assistant the third step "Clean up NuGet package references" gets stuck in a loop, adding a reference to Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers over and over again.

This reference is then found 3 times (= MaxAnalysisIterations) in the project file. The likely reason for the loop is that when Microsoft.DotNet.UpgradeAssistant.Steps.Packages.PackageUpdaterStep calls projectFile.SaveAsync(token), the project isn't reloaded correctly and changes are lost.

Digging a bit deeper, the SaveAsync method tries to reload a MSBuildWorkspace after writing the updated file. There are relevant log entries that referenced projects (which all have been upgraded to step 2) are missing metadata, these log entries are stated as warnings, but they are likely errors.

ansedd95 commented 2 years ago

Using upgrade assistant for Optimizely projects, we are having this issue as well.

shahramshahram commented 2 years ago

If the project has more that one packages.config file then the issue can be reproducible at least with our Optimizely CMS product. A workaround for our projects was keep the main packages.config and remove others packages.config files. Here is the link to workaround https://github.com/episerver/upgrade-assistant-extensions under known issues.