diff --git a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs index 662aa48bacb..8eab522ca5d 100644 --- a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +++ b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs @@ -2528,5 +2528,35 @@ public async Task ProcessingProjectWithAspireDoesNotFailEvenThoughWorkloadIsNotI """ ); } + + [Fact] + public async Task UnresolvablePropertyDoesNotStopOtherUpdates() + { + // the property `$(MauiVersion)` cannot be resolved + await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1", + projectContents: """ + + + net8.0 + + + + + + + """, + expectedProjectContents: """ + + + net8.0 + + + + + + + """ + ); + } } } diff --git a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs index 0f1ffea3cf7..33c72506507 100644 --- a/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +++ b/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs @@ -264,7 +264,8 @@ public static IEnumerable GetTopLevelPackageDependencyInfos(Immutabl var evaluationResult = GetEvaluatedValue(packageVersion, propertyInfo); if (evaluationResult.ResultType != EvaluationResultType.Success) { - throw new InvalidDataException(evaluationResult.ErrorMessage); + // if we can't resolve the package version, don't report the dependency + continue; } packageVersion = evaluationResult.EvaluatedValue.TrimStart('[', '(').TrimEnd(']', ')');