-
Notifications
You must be signed in to change notification settings - Fork 643
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
Error when hiding the last package #1627
Comments
Thanks! We can probably make the fix soon, but would you like to just submit a Pull Request? If so, we can accept it right away :). |
@fabiostawinski Would you like to send us a PR for this? |
Actually, I can't get an error to raise in our code. We have logic that checks in the package is null and if so, treats it as a delete, which is valid in this case since we currently only index the latest version of each package. Closing for now, but if you have more details feel free to reopen and comment. |
Fixed the Trace.Activity for the line 101. Before is was accessing a null variable.
I submitted a PR, I tested again here and I got the issue again. The problems wasn't exactly what I said, but the Trace.Activity which was trying to access a property of a null object. I submited the PR. Please verify. |
Creating PR in dev branch - NuGet#1703
I was unlisting two packages.
I found where is the issue, it's in LuceneIndexService.cs, method public void UpdatePackage(Package package).
This code below, replaces the package by null:
if (!package.IsLatest || package.IsLatestStable)
{
// Someone passed us in a version which was e.g. just unlisted? Or just not the latest version which is what we want to index. Doesn't really matter. We'll find one to index.
package = _packageRepository.GetAll()
.Where(p => (p.IsLatest || p.IsLatestStable) && p.PackageRegistrationKey == packageRegistrationKey)
.Include(p => p.PackageRegistration)
.Include(p => p.PackageRegistration.Owners)
.Include(p => p.SupportedFrameworks)
.FirstOrDefault();
}
Then I fixed by this code:
if (!package.IsLatest || package.IsLatestStable)
{
// Someone passed us in a version which was e.g. just unlisted? Or just not the latest version which is what we want to index. Doesn't really matter. We'll find one to index.
package = _packageRepository.GetAll()
.Where(p => p.PackageRegistrationKey == packageRegistrationKey)
.Include(p => p.PackageRegistration)
.Include(p => p.PackageRegistration.Owners)
.Include(p => p.SupportedFrameworks)
.FirstOrDefault();
}
My change was in the "Where", I removed "(p.IsLatest || p.IsLatestStable) && " because for me it doesn't make sense. Now it works.
The text was updated successfully, but these errors were encountered: