dotnet / dotnet/dotnet-api-docs

Misleading documentation about `Close` and `Abort`

Open
#880 0 comments 1 reaction 0 assignees View on GitHub
area-System.Net dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

The remarks for this class discuss Close and Abort as if they are operations that can be performed directly on the `HttpListenerContext`, but these are methods are instead declared on `HttpListenerResponse`.

It *appears* that the caller of `HttpListener.GetContext` (or one of its asynchronous variants) is responsible for calling one of `Dispose`/`Close`/`Abort` on the `Response` in order to ensure that system resources are freed appropriately, but this is not terribly clear from the documentation.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 8d6db24e-a10b-c55c-e89c-0eb00da2b7dc
* Version Independent ID: fdb8413a-18d4-fdc2-85a7-322eb720f348
* Content: [HttpListenerContext Class (System.Net)](https://docs.microsoft.com/en-us/dotnet/api/system.net.httplistenercontext?view=netframework-4.7.2#feedback)
* Content Source: [xml/System.Net/HttpListenerContext.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Net/HttpListenerContext.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Research direction

Start with xml/System.Net/HttpListenerContext.xml and review the remarks for HttpListenerContext alongside the HttpListenerResponse documentation. Clarify that Close and Abort belong to HttpListenerResponse and explain the responsibility for releasing resources after HttpListener.GetContext or its asynchronous variants. Done means the class documentation no longer attributes these operations to the context and clearly describes the response cleanup expectation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.