Skip to content

Update CSharp CodeFix Verifiers code to avoid using ServicePointManager #7388

Open

Description

This PR was meant as a workaround: #7387

Ideally, we should replace the failing functionality using ServicePointManager to instead use the preferred newer APIs, as the error below indicates.

If we get this fixed in main, it could also be backported to the newest .NET 9 branch, as it was cherry-picked to unblock that branch #7386 .

The error:

/mnt/vss/_work/1/s/src/Test.Utilities/CSharpSecurityCodeFixVerifier`2+Test.cs(24,21): error SYSLIB0014: 'ServicePointManager' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead. Settings on ServicePointManager no longer affect SslStream or HttpClient.' (https://aka.ms/dotnet-warnings/SYSLIB0014) [/mnt/vss/_work/1/s/src/Test.Utilities/Test.Utilities.csproj]
/mnt/vss/_work/1/s/src/Test.Utilities/CSharpSecurityCodeFixVerifier`2+Test.cs(29,21): error SYSLIB0014: 'ServicePointManager' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead. Settings on ServicePointManager no longer affect SslStream or HttpClient.' (https://aka.ms/dotnet-warnings/SYSLIB0014) [/mnt/vss/_work/1/s/src/Test.Utilities/Test.Utilities.csproj]
/mnt/vss/_work/1/s/src/Test.Utilities/CSharpCodeFixVerifier`2+Test.cs(27,21): error SYSLIB0014: 'ServicePointManager' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead. Settings on ServicePointManager no longer affect SslStream or HttpClient.' (https://aka.ms/dotnet-warnings/SYSLIB0014) [/mnt/vss/_work/1/s/src/Test.Utilities/Test.Utilities.csproj]
/mnt/vss/_work/1/s/src/Test.Utilities/CSharpCodeFixVerifier`2+Test.cs(32,21): error SYSLIB0014: 'ServicePointManager' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead. Settings on ServicePointManager no longer affect SslStream or HttpClient.' (https://aka.ms/dotnet-warnings/SYSLIB0014) [/mnt/vss/_work/1/s/src/Test.Utilities/Test.Utilities.csproj]
D:\a\_work\1\s\src\NetAnalyzers\UnitTests\Microsoft.NetCore.Analyzers\Security\DataSetDataTableInWebSerializableObjectGraphTests.cs(93,13): error SYSLIB0014: 'ServicePointManager' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead. Settings on ServicePointManager no longer affect SslStream or HttpClient.' (https://aka.ms/dotnet-warnings/SYSLIB0014) [D:\a\_work\1\s\src\NetAnalyzers\UnitTests\Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj]
D:\a\_work\1\s\src\NetAnalyzers\UnitTests\Microsoft.NetCore.Analyzers\Security\DataSetDataTableInWebSerializableObjectGraphTests.cs(113,13): error SYSLIB0014: 'ServicePointManager' is obsolete: 'WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead. Settings on ServicePointManager no longer affect SslStream or HttpClient.' (https://aka.ms/dotnet-warnings/SYSLIB0014) [D:\a\_work\1\s\src\NetAnalyzers\UnitTests\Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    help wantedThe issue is up-for-grabs, and can be claimed by commenting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions