diff --git a/TwinpackCore/Core/TwinpackService.cs b/TwinpackCore/Core/TwinpackService.cs index eb8ccdc..98ec3d7 100644 --- a/TwinpackCore/Core/TwinpackService.cs +++ b/TwinpackCore/Core/TwinpackService.cs @@ -569,6 +569,7 @@ private async Task> AffectedPackagesAsync(List pa { if (package.Package == null || package.PackageVersion == null || package.PackageServer == null) { + package.Package = null; package.PackageVersion = null; package.PackageServer = null; var resolvedPackage = await _packageServers.FetchPackageAsync(package.PackageServer, package.ProjectName, package.PlcName, package.Config, includeMetadata: true, _automationInterface, cancellationToken); diff --git a/TwinpackTests/TwinpackServiceTest.cs b/TwinpackTests/TwinpackServiceTest.cs index f1b1b08..c77d5a8 100644 --- a/TwinpackTests/TwinpackServiceTest.cs +++ b/TwinpackTests/TwinpackServiceTest.cs @@ -1387,5 +1387,25 @@ public async Task AffectedPackages_PreferPassedPackageItems() Assert.AreEqual("ZPlatform", platformPackage.PackageVersion.Name); Assert.AreEqual("main", platformPackage.PackageVersion.Branch); } + + [TestMethod] + public async Task AffectedPackages_IgnoreNotAvailableDependencies() + { + var twinpack = BuildMultiBranchDependencies(); + + var packages = await twinpack.AffectedPackagesAsync( + new List() + { + new PackageItem() + { + Config = new ConfigPlcPackage { Name = "NotExisting", Version = "1.5.0.1", Branch = "main" }, + Package = new PackageGetResponse { Name = "NotExisting" }, + PackageVersion = new PackageVersionGetResponse { Name = "NotExisting", Version = "1.5.0.1", Branch = "main" }, + PackageServer = null + }, + }); + + Assert.AreEqual(0, packages.Count()); + } } }