From 9dcde5f8a182a9202a50afa92fec463f6654ecd9 Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Mon, 11 Oct 2021 09:59:38 -0400 Subject: [PATCH] Remove assert preventing empty PKCS7 exports (#59812) An empty PKCS7 collection is valid, so don't require the certHandles count to be greater than 0. Before: ``` DOTNET : ((null) warning) Process terminated due to " at System.Diagnostics.DebugProvider.Fail(String message, String detailMessage) DOTNET : at System.Diagnostics.Debug.Fail(String message, String detailMessage) DOTNET : at System.Diagnostics.Debug.Assert(Boolean condition, String message, String detailMessage) DOTNET : at System.Diagnostics.Debug.Assert(Boolean condition) ``` After: ``` [PASS] System.Security.Cryptography.X509Certificates.Tests.CollectionTests.ExportPkcs7_Empty ``` --- .../src/Internal/Cryptography/Pal.Android/StorePal.ExportPal.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/StorePal.ExportPal.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/StorePal.ExportPal.cs index ef28cdf69f8e2..b98ed82966316 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/StorePal.ExportPal.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Android/StorePal.ExportPal.cs @@ -39,7 +39,6 @@ protected override byte[] ExportPkcs7() } } - Debug.Assert(certHandles.Length > 0); return Interop.AndroidCrypto.X509ExportPkcs7(certHandles); }