protected async override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (string.Equals(e.PropertyName, nameof(SelectedVersion))) { if ((e.OldValue is null && SelectedVersion == Package.Identity.Version) || e.NewValue is null) { // Skip loading on version list first load return; } var identity = new PackageIdentity(Package.Identity.Id, SelectedVersion); VersionData = await LoadSinglePackageMetadataAsync(identity, Package, _settingsProvider.Model.IsPreReleaseIncluded); if (Package is not null) { // Note: Workaround, this is a hack way to set specific version of package var tempPackage = new NuGetPackage(VersionData, Package.FromPage); tempPackage.AddDependencyInfo(VersionData.Identity.Version, VersionData.DependencySets); ValidateCurrentPackage(tempPackage); } } }
protected static async Task <IPackageSearchMetadata> LoadSinglePackageMetadataAsync(PackageIdentity identity, NuGetPackage packageModel, bool isPreReleaseIncluded) { try { var versionMetadata = await PackageMetadataProvider?.GetPackageMetadataAsync(identity, isPreReleaseIncluded, CancellationToken.None); if (versionMetadata?.Identity?.Version is not null) { packageModel.AddDependencyInfo(versionMetadata.Identity.Version, versionMetadata.DependencySets); } return(versionMetadata); } catch (Exception ex) { Log.Error(ex, "Metadata retrieve error"); return(null); } }