Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit a994f65

Browse files
author
Atsushi Kanamori
committed
Fix all failures in Security.Cryptography.Encoding.Tests on ILC
1 parent 064e0d8 commit a994f65

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/System.Security.Cryptography.Encoding/tests/AsnEncodedDataCollectionTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,13 @@ public static void CopyExceptions()
124124
Assert.Throws<ArgumentOutOfRangeException>(() => c.CopyTo(a, 3));
125125
Assert.Throws<ArgumentException>(() => c.CopyTo(a, 1));
126126

127-
// Array has non-zero lower bound
128-
ICollection ic = c;
129-
Array array = Array.CreateInstance(typeof(object), new int[] { 10 }, new int[] { 10 });
130-
Assert.Throws<IndexOutOfRangeException>(() => ic.CopyTo(array, 0));
127+
if (PlatformDetection.IsNonZeroLowerBoundArraySupported)
128+
{
129+
// Array has non-zero lower bound
130+
ICollection ic = c;
131+
Array array = Array.CreateInstance(typeof(object), new int[] { 10 }, new int[] { 10 });
132+
Assert.Throws<IndexOutOfRangeException>(() => ic.CopyTo(array, 0));
133+
}
131134
}
132135

133136

src/System.Security.Cryptography.Encoding/tests/OidCollectionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private static void ValidateCopyToThrows(
127127
additionalValidation?.Invoke(c);
128128
}
129129

130-
[Fact]
130+
[ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))]
131131
public void CopyTo_NonZeroLowerBound_ThrowsIndexOutOfRangeException()
132132
{
133133
Oid item = new Oid(Sha1Oid, Sha1Name);

src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@
2626
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
2727
<Link>Common\System\AssertExtensions.cs</Link>
2828
</Compile>
29+
<Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
30+
<Link>Common\System\PlatformDetection.cs</Link>
31+
</Compile>
2932
<Compile Include="$(CommonTestPath)\System\Security\Cryptography\ByteUtils.cs">
3033
<Link>CommonTest\System\Security\Cryptography\ByteUtils.cs</Link>
3134
</Compile>
3235
</ItemGroup>
3336
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
34-
</Project>
37+
</Project>

0 commit comments

Comments
 (0)