Skip to content

SYSLIB0057 (X509Certificate2 ctor is obsolete) errors in runtime code base #106472

Closed
@ViktorHofer

Description

@ViktorHofer
C:\git\runtime3\src\libraries\Common\tests\System\Net\Configuration.Certificates.cs(50,51): error SYSLIB0057: 'X509Certificate2.X509Certificate2(byte[], string?, X509K
eyStorageFlags)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https:
//aka.ms/dotnet-warnings/SYSLIB0057) [C:\git\runtime3\src\libraries\System.Net.WebSockets.Client\tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj]
C:\git\runtime3\src\libraries\Common\tests\System\Net\Configuration.Certificates.cs(51,51): error SYSLIB0057: 'X509Certificate2.X509Certificate2(byte[], string?, X509K
eyStorageFlags)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https:
//aka.ms/dotnet-warnings/SYSLIB0057) [C:\git\runtime3\src\libraries\System.Net.WebSockets.Client\tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj]
C:\git\runtime3\src\libraries\Common\tests\System\Net\Configuration.Certificates.cs(52,50): error SYSLIB0057: 'X509Certificate2.X509Certificate2(byte[], string?, X509K
eyStorageFlags)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https:
//aka.ms/dotnet-warnings/SYSLIB0057) [C:\git\runtime3\src\libraries\System.Net.WebSockets.Client\tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj]
C:\git\runtime3\src\libraries\Common\tests\System\Net\Configuration.Certificates.cs(53,61): error SYSLIB0057: 'X509Certificate2.X509Certificate2(byte[], string?, X509K
eyStorageFlags)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https:
//aka.ms/dotnet-warnings/SYSLIB0057) [C:\git\runtime3\src\libraries\System.Net.WebSockets.Client\tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj]
C:\git\runtime3\src\libraries\Common\tests\System\Net\Configuration.Certificates.cs(54,61): error SYSLIB0057: 'X509Certificate2.X509Certificate2(byte[], string?, X509K
eyStorageFlags)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https:
//aka.ms/dotnet-warnings/SYSLIB0057) [C:\git\runtime3\src\libraries\System.Net.WebSockets.Client\tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj]
C:\git\runtime3\src\libraries\Common\tests\System\Net\Configuration.Certificates.cs(94,40): error SYSLIB0057: 'X509Certificate2.X509Certificate2(byte[])' is obsolete:
'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https://aka.ms/dotnet-warnings/SYSLI
B0057) [C:\git\runtime3\src\libraries\System.Net.WebSockets.Client\tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj]
C:\git\runtime3\src\libraries\Common\tests\System\Net\Http\TestHelper.cs(145,28): error SYSLIB0057: 'X509Certificate2.X509Certificate2(byte[], string?)' is obsolete: '
Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https://aka.ms/dotnet-warnings/SYSLIB
0057) [C:\git\runtime3\src\libraries\System.Net.WebSockets.Client\tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj]

Repro: build.cmd libs && dotnet.cmd build src\libraries\System.Net.WebSockets.Client\tests\wasm\System.Net.WebSockets.Client.Wasm.Tests.csproj

I also had to add this line to that csproj:

    <Compile Include="$(CommonTestPath)System\Net\Http\TestHelper.cs"
             Link="Common\System\Net\Http\TestHelper.cs" />

cc @bartonjs @vcsjones

Metadata

Metadata

Assignees

Labels

area-System.Net.Securityin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions