Last post Dec 21, 2017 11:28 PM by mjl001
Dec 16, 2017 09:45 PM|mjl001|LINK
I have a .Net Core SignalR server and UWP application that successfully pushes a JSON formatted string to an UWP client.
I have in the same solution, using the same .dll as the UWP application a Xamarin Forms app. It has the SignalR Xamarin Forms Nuget package installed. The UWP and Xamarin app both consume a .Net Standard 2 .dll that handles all of the interaction with the
The UWP app works perfectly, but when I make exactly the same call with exactly the same parameters, the SignalR client-side code in the Xamarin App throws an internal exception:
An exception was thrown from the 'Received' event handler. System.FormatException: Messages over 2GB in size are not supported
There are 15 fields in the JSON structure and it is all values like integer, bool and double. There are also a couple of short strings that are no longer than a dozen or so characters each. The size of the entire JSON structure is will under 1K.
A possible cause might be the fact that I am using some nullable types like int?, and bool?
I can supply the full error stack if it helps. I didn't include it in this message because of its size.
Does anyone have any ideas?
Dec 18, 2017 05:19 AM|Fei Han - MSFT|LINK
According to your description, I can know that you have a SignalR Hub server and different Client apps that connect to your Hub server, and Hub server can push JSON structure data/message to UWP client, pushing functionality is not working as expected in
your Xamarin app.
Messages over 2GB in size are not supported
To troubleshoot the issue, you can try to debug and trace the message that you need to pushed to the clients and check the real size of the message/data in your hub method. Besides, please try to push plain text testing message to your Xamarin clients, such
as “hello”, and check if clients can receive the message without error.
Dec 19, 2017 06:34 PM|mjl001|LINK
Thank you for your response.
I should also point out that I am using ASP.Net Core 2.x and the Alpha of SignalR for .Net Core 2.x.
I have examined the message by writing it to file prior to pushing it to client applications and the size is less than 1K. Exactly the same message is being pushed from the same server side code to both UWP and Xamarin clients. I am using exactly the same
code on the receiving end as well as both. All SignalR interaction on the client side is managed inside of theat .Net Standard Core.dll. Both the Xamarin and UWP apps reference that .dll. The only difference is that the consumers of that .dll are different;
one is UWP and the other is Android.
The Xamarin Forms app required the installation of the Xamarin version of SignalR so that it could reference the Core.dll that contains that contains the code that actually processes the SignalR code. Could this be the source of the problems and should I
not even attempt to reuse the same .Net Standard SignalR enabled .dll across a UWP and Xamarin project?
I have yet to try sending a "Hello World" simple text message to the Xamarin app. I have tested that on the UWP app. It was the very first thing I attempted to get working with SignalR in that app and it works fine. I will give that a try sometime in the
next few days.
Dec 19, 2017 07:26 PM|mjl001|LINK
I just tested the messaging with a simple string that is sent in the OnConnected event on the server side and the same exception is thrown indication that a message may not exceed 2GB.
On the server side:
public override async Task OnConnectedAsync()
await Clients.Client(Context.ConnectionId).InvokeAsync("UpdateConnectionStatus", "Connected");
On the client side:
HubConnection.On<string>("UpdateConnectionStatus", data =>
MessagingCenter.Send<HubClient, string>(this, MessageTypes.UI_UpdateSignalRStatus.ToString(), data);
A breakpoint on the Debug.Wirteline.... line of code is never hit in the Xamarin app, but it is hit in the Xamarin app.
Here are the first dozen or so lines from the of the exception that is thrown
12/19/2017 14:14:03: Connection Id b9d3f51c-ebad-4bcc-88e5-e3a049609550: An exception was thrown from the 'Received' event handler.
System.FormatException: Messages over 2GB in size are not supported
at Microsoft.AspNetCore.SignalR.Internal.Formatters.BinaryMessageParser.TryParseMessage (System.ReadOnlyBuffer`1[System.Byte]& buffer, System.ReadOnlyBuffer`1[System.Byte]&
payload) [0x00034] in <ebc20eebf7604e23a92256d8ba9f5464>:0
at Microsoft.AspNetCore.SignalR.Internal.Protocol.MessagePackHubProtocol.TryParseMessages (System.ReadOnlyBuffer`1[T] input, Microsoft.AspNetCore.SignalR.Internal.IInvocationBinder
binder, System.Collections.Generic.IList`1[Microsoft.AspNetCore.SignalR.Internal.Protocol.HubMessage]& messages) [0x00007] in <ebc20eebf7604e23a92256d8ba9f5464>:0
at Microsoft.AspNetCore.SignalR.Internal.HubProtocolReaderWriter.ReadMessages (System.Byte input, Microsoft.AspNetCore.SignalR.Internal.IInvocatio12-19
14:14:03.445 I/mono-stdout(13623): [41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Sockets.Client.HttpConnection
nBinder binder, System.Collections.Generic.IList`1[Microsoft.AspNetCore.SignalR.Internal.Protocol.HubMessage]& messages) [0x00019] in <ebc20eebf7604e23a92256d8ba9f5464>:0
at Microsoft.AspNetCore.SignalR.Client.HubConnection+<OnDataReceivedAsync>d__31.MoveNext () [0x00011] in <a8c19fbc9a304fd7975d8b65eaa84f32>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0
at System.Runtime.CompilerServic12-19 14:14:03.446 I/mono-stdout(13623): 12/19/2017 14:14:03: Connection Id b9d3f51c-ebad-4bcc-88e5-e3a049609550:
An exception was thrown from the 'Received' event handler.
es.TaskAwaiter.GetResult () [0x00000] in
at Microsoft.AspNetCore.Sockets.Client.HttpConnection+<>c__DisplayClass49_0+<<ReceiveAsync>b__0>d.MoveNext () [0x00099] in <cea2d398efda4b90925321368c204765>:0
12-19 14:14:03.446 I/mono-stdout(13623): System.FormatException: Messages over 2GB in size are not supported
Dec 21, 2017 02:15 AM|Fei Han - MSFT|LINK
Your SignalR Hub server can push messages to different Client apps successfully, except Xamarin App. You can try to get help in Xamarin related forums.
Dec 21, 2017 11:28 PM|mjl001|LINK
Thanks. I will try there.