dotnet / dotnet/dotnet-api-docs
WebSocket thread-safety: Copy relevant ManagedWebSocket code comments into Microsoft Learn WebSocket docs (if true for WebSocket class broadly)
- Lingua principale
- C#
- Stelle
- 949
- Fork
- 1.7k
- Merge medio
- 2g 19h
- PR unite (30g)
- 52
Descrizione
### Describe the issue or suggestion
ManagedWebSocket has some useful comments on thread safety [above the class, in the code](https://github.com/dotnet/dotnet/blob/b4a1104/src/runtime/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs#L23-L28).
The first ("It's acceptable to call ReceiveAsync and SendAsync in parallel. One of each may run concurrently.") is well-covered on Microsoft Learn.
The second ("It's acceptable to have a pending ReceiveAsync while CloseOutputAsync or CloseAsync is called.") is useful information that I do not see on Microsoft Learn. It would be useful on CloseAsync and CloseOutputAsync (it is safe to call close methods with ReceiveAsync pending, but perhaps noting the socket will transition to aborted if other operations e.g. SendAsync, are pending). It would also be relevant on ReceiveAsync.
The third ("Attempting to invoke any other operations in parallel may corrupt the instance.") is also not documented. This could be on WebSocket itself. For example, this implies that calling CloseAsync with a SendAsync pending may corrupt the instance.
I understand that these remarks are for **ManagedWebSocket**, not WebSocket itself. Therefore, someone on the WebSocket team will need to assess whether these guarantees are intended to apply to **all** implementations of the abstract WebSocket class.
If so, this is valuable information.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start with the thread-safety comments above ManagedWebSocket in src/runtime/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs, then compare the WebSocket, ReceiveAsync, CloseAsync, and CloseOutputAsync pages on Microsoft Learn. Confirm with the WebSocket team whether these guarantees apply to all WebSocket implementations. Done means the applicable concurrency and pending-operation behavior is documented on the relevant API pages.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- documentation, networking
- Tipo di issue
- Documentazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100