dotnet / dotnet/dotnet-api-docs

WebSocket.CloseStatus: Actual value is null when socket is open, not non-existent WebSocketCloseStatus.None

Open Beginner friendly
#12,884 1 comment 0 reactions 0 assignees View on GitHub
area-System.Net untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

### Type of issue

Code doesn't work

### Description

[WebSocket.CloseStatus Property (8.0)](https://learn.microsoft.com/en-us/dotnet/api/system.net.websockets.websocket.closestatus?view=net-8.0) states, "If the close handshake has not been initiated yet, WebSocketCloseStatus.None is returned."

Actually, `WebSocketCloseStatus.None` does not exist. Before the close handshake begins, `CloseStatus` is `null`, as noted [in the field declaration](https://github.com/dotnet/runtime/blob/46c393aef810d1a4a3027fc208ae5414d2fdf2ce/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs#L85). (The actual [CloseStatus property](https://github.com/dotnet/runtime/blob/46c393aef810d1a4a3027fc208ae5414d2fdf2ce/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs#L289) just returns the backing field.)

### Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.net.websockets.websocket.closestatus?view=net-8.0

### Content source URL

https://github.com/dotnet/dotnet-api-docs-temp/blob/live/xml/System.Net.WebSockets/WebSocket.xml

### Document Version Independent Id

309b1648-c776-ccd8-f070-942978354273

### Platform Id

a928965b-7541-0003-9034-7d2e0789857b

### Article author

@karelz

Contributor guide

Open the contributing guide

Research direction

Open the linked WebSocket.xml source and locate the CloseStatus property documentation. Compare its statement about the pre-handshake value with the linked ManagedWebSocket field and property references, then update the wording to describe the documented behavior accurately. Done means the API page no longer claims that WebSocketCloseStatus.None is returned.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.