Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,19 @@ public void RoundTripFromTaskItemsToFileToXml()
new TaskItem(localPackagePath, new Dictionary<string, string>()
{
{ "CertificateName", "IHasACert2" }
}),
// Added per issue: dotnet/arcade#7064
new TaskItem("Microsoft.DiaSymReader.dll", new Dictionary<string, string>()
{
{ "CertificateName", "MicrosoftWin8WinBlue" },
{ "TargetFramework", ".NETFramework,Version=v2.0" },
{ "PublicKeyToken", "31bf3856ad364e35" }
}),
new TaskItem("Microsoft.DiaSymReader.dll", new Dictionary<string, string>()
{
{ "CertificateName", "Microsoft101240624" },
{ "TargetFramework", ".NETStandard,Version=v1.1" },
{ "PublicKeyToken", "31bf3856ad364e35" }
})
};

Expand Down Expand Up @@ -476,6 +489,20 @@ public void RoundTripFromTaskItemsToFileToXml()
item.PublicKeyToken.Should().Be("abcdabcdabcdabcd");
});
modelFromFile.SigningInformation.FileSignInfo.Should().SatisfyRespectively(
item =>
{
item.Include.Should().Be("Microsoft.DiaSymReader.dll");
item.CertificateName.Should().Be("Microsoft101240624");
item.TargetFramework.Should().Be(".NETStandard,Version=v1.1");
item.PublicKeyToken.Should().Be("31bf3856ad364e35");
},
item =>
{
item.Include.Should().Be("Microsoft.DiaSymReader.dll");
item.CertificateName.Should().Be("MicrosoftWin8WinBlue");
item.TargetFramework.Should().Be(".NETFramework,Version=v2.0");
item.PublicKeyToken.Should().Be("31bf3856ad364e35");
},
item =>
{
item.Include.Should().Be("test-package-a.1.0.0.nupkg");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,19 @@ public SigningInformationModel CreateSigningInformationModelFromItems(
foreach (var signInfo in fileSignInfo)
{
var attributes = signInfo.CloneCustomMetadata() as IDictionary<string, string>;
parsedFileSignInfo.Add(new FileSignInfoModel { Include = Path.GetFileName(signInfo.ItemSpec), CertificateName = attributes["CertificateName"] });
var fileSignInfoModel = new FileSignInfoModel { Include = Path.GetFileName(signInfo.ItemSpec), CertificateName = attributes["CertificateName"] };

if (attributes.TryGetValue("PublicKeyToken", out string publicKeyTokenValue))
{
fileSignInfoModel.PublicKeyToken = publicKeyTokenValue;
}

if (attributes.TryGetValue("TargetFramework", out string targetFrameworkValue))
{
fileSignInfoModel.TargetFramework = targetFrameworkValue;
}

parsedFileSignInfo.Add(fileSignInfoModel);
}
}
if (fileExtensionSignInfo != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,36 @@ public void ManifestModelToXmlValidatesFileSignInfos(Type exceptionType, params
VerifyToXml(exceptionType, signInfo);
}

/// <summary>
/// Per issue: dotnet/arcade#7064
/// </summary>
[Fact]
public void ValidateSymreaderFileSignInfos()
{
List<FileSignInfoModel> models = new List<FileSignInfoModel>();
models.Add(new FileSignInfoModel()
{
Include = "Microsoft.DiaSymReader.dll",
CertificateName = "MicrosoftWin8WinBlue",
TargetFramework = ".NETFramework,Version=v2.0",
PublicKeyToken = "31bf3856ad364e35",
});
models.Add(new FileSignInfoModel()
{
Include = "Microsoft.DiaSymReader.dll",
CertificateName = "Microsoft101240624",
TargetFramework = ".NETStandard,Version=v1.1",
PublicKeyToken = "31bf3856ad364e35",
});

SigningInformationModel signInfo = new SigningInformationModel()
{
FileSignInfo = models
};

signInfo.ToXml().Should().NotBeNull();
}

/// <summary>
/// Given a set of explicit file sign infos that or are invalid,
/// Parse should throw with an appropriate error message if they are invalid.
Expand Down