[Problem/Question]
When using the Sendbird .NET SDK (version 4.0.1 and later) on .NET Framework 4.8, the WebSocket handshake fails with the following exception related to the User-Agent
header:
System.ArgumentException: The 'User-Agent' header must be modified using the appropriate property or method. Parameter name: name
[SDK Version]
4.0.1 and later (no issue in 4.0.0)
[Reproduction Steps]
- Create a .NET Framework 4.8 WPF project.
- Install Sendbird.Chat NuGet package version ≥ 4.0.1.
- Initialize and connect:
SendbirdChat.Init(new SbInitParams(AppId));
SendbirdChat.Connect(userId, accessToken, (user, error) => { /* … */ });
- Observe the exception thrown during the WebSocket handshake.
[Frequency]
100% — Every WebSocket connection attempt on .NET Framework 4.8 with SDK ≥ 4.0.1
[Current impact]
The SDK fails to initialize, preventing any real-time messaging functionality.
[Additional Context]
This appears to be caused by .NET Framework’s ClientWebSocketOptions
blocking restricted headers like User-Agent
. See discussion: :github.com/dotnet/runtime/issues/24822 (reflection-based workarounds are mentioned). We need guidance on any SDK‑level fix or recommended approach to bypass this restriction while continuing to use WebSockets.