Skip to content

Commit

Permalink
Don't exclude System.IO.Pipelines from TargetingPack version check (#…
Browse files Browse the repository at this point in the history
…39302)

Co-authored-by: Will Godbe <[email protected]>
  • Loading branch information
github-actions[bot] and wtgodbe authored Jan 10, 2022
1 parent 9fb2d4f commit d9521ac
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/Framework/test/TargetingPackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,17 @@ public void RefAssemblyReferencesHaveExpectedAssemblyVersions()

Assert.All(dlls, path =>
{
// Skip netstandard2.0 System.IO.Pipelines assembly. References have old versions.
var filename = Path.GetFileName(path);
if (!string.Equals("System.IO.Pipelines.dll", filename, StringComparison.OrdinalIgnoreCase))
{
using var fileStream = File.OpenRead(path);
using var peReader = new PEReader(fileStream, PEStreamOptions.Default);
var reader = peReader.GetMetadataReader(MetadataReaderOptions.Default);
using var fileStream = File.OpenRead(path);
using var peReader = new PEReader(fileStream, PEStreamOptions.Default);
var reader = peReader.GetMetadataReader(MetadataReaderOptions.Default);

Assert.All(reader.AssemblyReferences, handle =>
{
var reference = reader.GetAssemblyReference(handle);
var result = 0 == reference.Version.Revision;
Assert.All(reader.AssemblyReferences, handle =>
{
var reference = reader.GetAssemblyReference(handle);
var result = (0 == reference.Version.Revision && 0 == reference.Version.Build);

Assert.True(result, $"In {filename}, {reference.GetAssemblyName()} has unexpected version {reference.Version}.");
});
}
Assert.True(result, $"In {Path.GetFileName(path)}, {reference.GetAssemblyName()} has unexpected version {reference.Version}.");
});
});
}

Expand Down

0 comments on commit d9521ac

Please sign in to comment.