#4742·SignalR

JsonReaderException When Making a Connection to a SignalR Hub During Debugging...

Author: jrichmeierCreated May 6, 2025Updated Sep 4, 2025

I am attempting to add a protected SignalR hub to a Blazor project that uses Entra ID as the identity provider. Essentially, I am trying to combine the relevant parts from the sample SignalR Blazor app (here) with the sample Entra ID Blazor app (here).

If I leave off the Authorize attribute from both the ChatHub class and the Chat razor page, everything works as expected. Once I add these attributes, I get a JsonReaderException with the message "'<' is an invalid start of a value. LineNumber: 2 | BytePositionInLine: 0." on the line that calls the StartAsync method on the HubConnection instance. This only seems to happen during debugging and, once it happens, if I navigate back to the root page and then back to the chat page, the exception is not thrown, at least from what I observed.