Skip to content
Merged
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
Fix X509ChainElementCollection_CopyTo_NonZeroLowerBound_ThrowsIndexOu…
…tOfRangeException test on Android

It started to fail because the validity of the MicrosoftDotComSslCertBytes expired on 2021-08-29 22:17:02.
Since this test doesn't need to validate a specific expiration time we can just set the VerificationTime on the chain like we do in other tests.

Fixes #58416
  • Loading branch information
akoeplinger authored and github-actions committed Sep 1, 2021
commit 4df8aceb5be790961dc40a0b36c95847704c3e97
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,13 @@ public static void X509ChainElementCollection_CopyTo_NonZeroLowerBound_ThrowsInd
chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllFlags;

chain.Build(microsoftDotCom);
// Halfway between microsoftDotCom's NotBefore and NotAfter
// This isn't a boundary condition test.
chain.ChainPolicy.VerificationTime = new DateTime(2021, 02, 26, 12, 01, 01, DateTimeKind.Local);

bool valid = chain.Build(microsoftDotCom);
Assert.True(valid, "Precondition: Chain built validly");

ICollection collection = chain.ChainElements;
Array array = Array.CreateInstance(typeof(object), new int[] { 10 }, new int[] { 10 });
Assert.Throws<IndexOutOfRangeException>(() => collection.CopyTo(array, 0));
Expand Down