-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Address obsolete ContentItemGroup.FindItems in PackageValidation #23301
Comments
@ericstj thanks for tagging me on this issue. FindItems was cleaned up and marked as obsolete as part of a memory overallocation fix but looking at this more closely, I believe FindItems should remain and not be obsolete. PopulateItemGroups replaces FindItemGroups which uses yield returns, and on a hot code path, resulted in the overallocation of enumerator objects. FindItems used to use yield returns as well but I fixed its implementation to no longer use yield returns so it does not need to be obsolete. I've created a bug NuGet/Home#11487 and submitted a fix to remove the obsolete attribute from FindItems in this PR: NuGet/NuGet.Client#4394. Thanks! |
Excellent! Thank you @jebriede! We will remove the obsolete suppression once that change is in. |
Fixed with dbefb9f by removing the pragma as the underlying API isn't obsolete anymore. |
We use
ContentItemCollection.FindItemGroups
in package validation to replicate NuGet's asset selection algorithm:sdk/src/Compatibility/Microsoft.DotNet.PackageValidation/Package.cs
Lines 33 to 39 in c63af09
As of NuGet/NuGet.Client@bcd6856 this method is obsolete. The newly introduced method
PopulateItemGroups
does too much (allocating groups that we'd have to flatten).For now I've disabled the obsoletion warning. We should decide what to do moving forward, either have NuGet add an API or change how we do asset selection in the package. It may be convenient to solve this while addressing #17364
Originally found here: #23277 (comment)
The text was updated successfully, but these errors were encountered: