[Bug]: Very slow restore when using NoWarn in single project that has lots of dependents #11222
Labels
Functionality:Restore
Priority:2
Issues for the current backlog.
Product:dotnet.exe
Tenet:Performance
Performance issues
Type:Bug
NuGet Product Used
MSBuild.exe
Product Version
16.11
Worked before?
No response
Impact
I'm unable to use this version
Repro Steps & Context
When you have a large project tree with lots of transitive project references and packages, the calculation transitive NoWarn values takes forever. This code is attempting to search through transitive references:
https://github.com/NuGet/NuGet.Client/blob/5df07c3271aebfbeb86269d59a98d1acc9996670/src/NuGet.Core/NuGet.Commands/RestoreCommand/Logging/TransitiveNoWarnUtils.cs#L163
But in the debugger I found the queue to contain millions of items. This causing a massive amount of allocations which leads to GC pressure and makes restore very slow.
Workaround
Currently, the only way to work around the issue is to remove all
NoWarn
definitions in specific projects and instead specify them in a common import likeDirectory.Build.props
so that every project has the exact same set ofNoWarn
. This makes the code not need to walk through recursively to determineNoWarn
.Verbose Logs
No response
The text was updated successfully, but these errors were encountered: