I am getting the following exception when running Xamarin Forms iOS app after upgrade to the latest Visual Studio Mac:
{System.TypeInitializationException: The type initializer for 'Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol' threw an exception. ---> System.MissingMethodException: Method not found: int System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeU…}
Code:
string token = s.AccessToken().Result;
_connection = new HubConnectionBuilder()
.WithUrl(serverUrl, options =>
{
options.AccessTokenProvider = () => Task.FromResult(token);
options.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.LongPolling;
})
//.WithAutomaticReconnect()
//.ConfigureLogging(logging =>
//{
// logging.AddDebug();
// logging.SetMinimumLevel(LogLevel.Debug);
//
//})
.Build();
I've tried adding various NuGet packages including System.Text.Json (5.0.1) but doesn't seem to be working. Any body else facing this and any suggestions how to fix? Android app is working OK.
xamarin forms - 5.0.0.2012
Xamarin.iOS Version: 14.14.2.5
Xamarin.Android Version: 11.2.0.0
Visual Studio Mac 8.9 (build 1651)
I had the same problem and the only thing that worked for me is to install System.Memory 4.5.0 (on IOS) that specific version any other version doesn't work for some reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With