Skip to content

Commit bb00416

Browse files
committed
http: fix SYSLIB0057 warning for X509Certificate2Collection.Import
Use ImportFromPemFile on modern .NET to resolve the SYSLIB0057 deprecation warning, while keeping the original Import call on .NET Framework where the new API is not available. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent 632413f commit bb00416

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/shared/Core/HttpClientFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ public HttpClient CreateClient()
130130

131131
// Import the custom certs
132132
X509Certificate2Collection certBundle = new X509Certificate2Collection();
133+
#if NETFRAMEWORK
133134
certBundle.Import(certBundlePath);
135+
#else
136+
certBundle.ImportFromPemFile(certBundlePath);
137+
#endif
134138

135139
try
136140
{

0 commit comments

Comments
 (0)