Skip to content

Commit

Permalink
Remove assert preventing empty PKCS7 exports (#59812)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
vcsjones authored Oct 11, 2021
1 parent 5f9fec9 commit 9dcde5f
Showing 1 changed file with 0 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ protected override byte[] ExportPkcs7()
}
}

Debug.Assert(certHandles.Length > 0);
return Interop.AndroidCrypto.X509ExportPkcs7(certHandles);
}

Expand Down

0 comments on commit 9dcde5f

Please sign in to comment.