Skip to content

Document that HttpListener isn't recommended for new development - #12937

Merged
MihaZupan merged 3 commits into
mainfrom
copilot/document-httplistener-discouragement
Aug 12, 2026
Merged

Document that HttpListener isn't recommended for new development#12937
MihaZupan merged 3 commits into
mainfrom
copilot/document-httplistener-discouragement

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

HttpListener is effectively in maintenance mode and its behavior differs substantially across platforms, but the docs gave no signal that it shouldn't be used for new code. This adds guidance following the existing pattern used for HttpWebRequest and SmtpClient.

Changes

  • New includeincludes/httplistener-not-recommended.md carries an [!IMPORTANT] notice stating that HttpListener receives only limited servicing, that its implementation and protocol support vary by platform (Windows HTTP.sys vs. a managed implementation on Linux/macOS with no HTTPS support), and pointing to ASP.NET Core/Kestrel as the recommended alternative.
  • HttpListener — include referenced from the type remarks and the constructor remarks; both summaries now end with "not recommended for new development; for more information, see the Remarks section," matching SmtpClient.
  • Related types — the same include added to the remarks of HttpListenerContext, HttpListenerRequest, HttpListenerResponse, HttpListenerPrefixCollection, and HttpListenerTimeoutManager, since users frequently land on those pages directly rather than on the HttpListener page.

Notes for reviewers

  • HttpListenerException, HttpListenerBasicIdentity, and HttpListener+ExtendedProtectionSelector were left untouched — they're narrow helper/exception types and unlikely entry points. Happy to add the notice there if preferred.
  • Member-level pages (for example HttpListener.Start) don't inherit type remarks. HttpWebRequest repeats its notice on every member; that was not done here to avoid excessive noise, but it's an option if consistency is preferred.

Internal previews

File Preview link
includes/httplistener-not-recommended.md includes/httplistener-not-recommended
xml/System.Net/HttpListener.xml xml/System.Net/HttpListener.xml
xml/System.Net/HttpListenerContext.xml xml/System.Net/HttpListenerContext.xml
xml/System.Net/HttpListenerPrefixCollection.xml xml/System.Net/HttpListenerPrefixCollection.xml
xml/System.Net/HttpListenerRequest.xml xml/System.Net/HttpListenerRequest.xml
xml/System.Net/HttpListenerResponse.xml xml/System.Net/HttpListenerResponse.xml
xml/System.Net/HttpListenerTimeoutManager.xml xml/System.Net/HttpListenerTimeoutManager.xml

Copilot AI and others added 2 commits August 5, 2026 11:56
Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
… types

Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
Copilot AI requested a review from MihaZupan August 5, 2026 14:56
@MihaZupan
MihaZupan marked this pull request as ready for review August 12, 2026 12:10
Copilot AI lite review requested due to automatic review settings August 12, 2026 12:10
@MihaZupan
MihaZupan requested review from a team as code owners August 12, 2026 12:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the .NET API reference docs to clearly indicate that System.Net.HttpListener is not recommended for new development, and to surface that guidance consistently on related HttpListener* pages via a shared include.

Changes:

  • Added a reusable include (includes/httplistener-not-recommended.md) describing limited servicing and cross-platform behavioral differences, and pointing to ASP.NET Core/Kestrel as the recommended alternative.
  • Updated HttpListener type and constructor docs to reference the “not recommended for new development” guidance and link readers to Remarks.
  • Added the same guidance to Remarks for commonly visited related types (HttpListenerContext, Request, Response, PrefixCollection, TimeoutManager).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
includes/httplistener-not-recommended.md New reusable admonition include explaining why HttpListener isn’t recommended for new development.
xml/System.Net/HttpListener.xml Adds “not recommended” messaging in the type summary and ctor summary and includes the new admonition in Remarks.
xml/System.Net/HttpListenerContext.xml Includes the new admonition in Remarks so guidance appears on the context page directly.
xml/System.Net/HttpListenerPrefixCollection.xml Includes the new admonition in Remarks to surface guidance on the prefixes collection page.
xml/System.Net/HttpListenerRequest.xml Includes the new admonition in Remarks to surface guidance on the request page.
xml/System.Net/HttpListenerResponse.xml Includes the new admonition in Remarks to surface guidance on the response page.
xml/System.Net/HttpListenerTimeoutManager.xml Includes the new admonition in Remarks to surface guidance on the timeout manager page.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread xml/System.Net/HttpListenerTimeoutManager.xml
Comment thread includes/httplistener-not-recommended.md

@ManickaP ManickaP left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@MihaZupan
MihaZupan merged commit 271355d into main Aug 12, 2026
8 checks passed
@MihaZupan
MihaZupan deleted the copilot/document-httplistener-discouragement branch August 12, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants