Skip to content

Obsolete old HTTP APIs #33125

@scalablecory

Description

@scalablecory

ObsoleteAttribute will be getting an update to support diagnostic IDs and URLs to help IDEs better manage obsolete API usage.

We should consider annotating WebRequest and WebClient with this. I frequently see asks for help with HTTP in .NET, and it's not uncommon to find them using one of these APIs without knowing we prefer them use HttpClient instead.

Something like

    [Obsolete(DiagnosticId="BCL1234", UrlFormat="https://aka.ms/obsoletedotnethttp")]
    public class WebRequest // Also: HttpWebRequest, FtpWebRequest, FileWebRequest (aka *WebRequest)
    {
    }

    [Obsolete(DiagnosticId="BCL1234", UrlFormat="https://aka.ms/obsoletedotnethttp")]
    public class WebClient
    {
    }

I would not want to create excessive warnings for users porting Framework apps to .NET 5, so this is predicated on IDE/compiler being updated to allow ignoring specific diagnostic IDs application-wide.

Metadata

Metadata

Assignees

Labels

area-System.Net.HttpdocumentationDocumentation bug or enhancement, does not impact product or test code

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions