Skip to content
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

Unable to list packages on Azure Artifacts server #137

Closed
dfreiberger opened this issue Aug 2, 2024 · 1 comment
Closed

Unable to list packages on Azure Artifacts server #137

dfreiberger opened this issue Aug 2, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@dfreiberger
Copy link

After publishing a nuget package with the below nuspec file to an azure feed, and successfully connecting and logging into the feed with Twinpack, I was not able to list the packages including this one.

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
  <metadata>
    <id>Core</id>
    <version>1.2.3.6</version>
    <title>MyCompany Library Core</title>
    <authors>MyCompany Corporation</authors>
    <!-- <owners></owners> -->
    <!-- <licenseUrl></licenseUrl> -->
    <projectUrl>https://link.to.repo</projectUrl>
    <!-- <iconUrl></iconUrl> -->
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>MyCompany Library Core version 1.2.3.6</description>
    <!-- <summary> </summary> -->
    <!-- <releaseNotes></releaseNotes> -->
    <copyright>MyCompany</copyright>
    <tags>Beckhoff TwinCAT XAE PLC Library Core</tags>
    <!-- <bugTrackerUrl></bugTrackerUrl> -->
    <!-- <docsUrl></docsUrl> -->
    <!-- <mailingListUrl></mailingListUrl> -->
    <!-- <packageSourceUrl></packageSourceUrl> -->
  </metadata>
  <files>
    <file src="Core.library" target="" />
  </files>
</package>

After troubleshooting, I found that the "Publish" field is null, which causes this section

Created = x.Published?.ToString(),
to throw a silent error and return no results.

The issue could be resolved by changing the code as follows:

new Tuple<IEnumerable<CatalogItemGetResponse>, bool>(
results.Select(x =>
    new CatalogItemGetResponse()
    {
        PackageId = null,
        Name = x.Identity.Id,
        DistributorName = x.Authors,
        // Description = x.Description, Beckhoff's descriptions are meh
        IconUrl = x.IconUrl?.ToString() ?? IconUrl,
        RuntimeLicense = 1,
        DisplayName = x.Identity.Id,
        Downloads = x.DownloadCount.HasValue ? (int)x.DownloadCount.Value : 0,  // Added null check
        Created = x.Published?.ToString() ?? "Unknown",  // Added null check
        Modified = x.Published?.ToString() ?? "Unknown"  // Added null check
    }).ToList(),
results.Any());                     
@iadonkey
Copy link
Contributor

iadonkey commented Aug 2, 2024

Thanks for this finding, isn't it only the download count though, which causes the issue? The other fields already had null checks

Will fix it and make a patch release 1.0.8 for the null checks

In your nuspec, you can also write a real description if you want. Will uncomment this line as well.
You don’t need the tags “Beckhoff TwinCAT XAE PLC” btw and in title you don’t need “MyCompany Library”

Just fyi: having this “Library” followed by the name of the library in tags is only a temporary thing. For Beckhoff’s packages we didn’t find any other way as we can’t read the library title from their compiled-library files, we only have an implementation that can read it from normal library files (which we currently don’t do, but will in the future)

@iadonkey iadonkey self-assigned this Aug 2, 2024
@iadonkey iadonkey added the bug Something isn't working label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants