deepgram-dotnet-sdk icon indicating copy to clipboard operation
deepgram-dotnet-sdk copied to clipboard

Getting exception in ProcessKeepAlive (v2 ListenWebSocketClient)

Open sgodin opened this issue 1 month ago • 1 comments

What is the current behavior?

Just switched from C# client 4.3.6 to 6.6.0 and I'm seeing an exception get logged from ProcessKeepAlive:

ProcessKeepAlive: System.NullReferenceException thrown Object reference not set to an instance of an object.

The exception is caught by the Deepgram client and is sent to the logger, so it shows up in the application logs.

Steps to reproduce

This appears to happen after the ListenWebSocketClient is closed, via SendClose().

Expected behavior

No error logged when closing the client.

Please tell us about your environment

Windows C#, VS2022.

sgodin avatar Oct 14 '25 16:10 sgodin

I also faced this exception logged. This happens because _cancellationTokenSource is set to null in Stop method https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/Deepgram/Abstractions/v2/AbstractWebSocketClient.cs#L645 while still being used in the loop inside ProcessKeepAlive https://github.com/deepgram/deepgram-dotnet-sdk/blob/5a30669febd30a64f1941cd1e8c8c895423d2d51/Deepgram/Clients/Listen/v2/WebSocket/Client.cs#L354

crui3er avatar Nov 04 '25 14:11 crui3er