Skip to content

Commit

Permalink
only report dependencies whose version numbers can be resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed Apr 2, 2024
1 parent ffd44ca commit 39bdff2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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: """
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="7.0.1" />
</ItemGroup>
</Project>
""",
expectedProjectContents: """
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>
"""
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ public static IEnumerable<Dependency> 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(']', ')');
Expand Down

0 comments on commit 39bdff2

Please sign in to comment.