Skip to content

SignalR eats JSON serialization exceptions during streaming responses #56303

Closed
@jasonmalinowski

Description

@jasonmalinowski

Is there an existing issue for this?

This somewhat feeds into #44383 but that's a more general tracking item.

Describe the bug

I had a line of code using SignalR like this:

await foreach (var response in conn.StreamAsync<ChatResponse>("Chat", req, cancellationToken))

The surprise I ran into was the server sent me a different JSON payload back, and the JSON object couldn't be deserialized. That's fine, but this serialization exception got converted to a StreamBindingFailureMessage with the exception stored. The surprise however is that doesn't get reported anywhere -- we hit the default case at

throw new InvalidOperationException($"Unexpected message type: {message.GetType().FullName}");
and the exception is thrown away.

Expected Behavior

The exception is propagated somewhere to make this debuggable.

.NET Version

8.0.6 of the SignalR library

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-signalrIncludes: SignalR clients and servers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions