Xamarin Forms SignalR iOS Client not working after VS Mac 8.9 upgrade

SSB 86 Reputation points
2021-03-09T09:19:45.453+00:00

Hi - i have just upgraded visual studio

xamarin forms on iOS app SignalR Client isn't working:

        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 am getting the following exception:

{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…}

Please can you help / advise? This has broken my app and there doesn't seem to be away to roll back to an older version of VS.

xamarin forms - 5.0.0.2012

Xamarin.iOS
Version: 14.14.2.5

Xamarin.Android
Version: 11.2.0.0

Seems to work OK on Android.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,296 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ryan Hill 25,981 Reputation points Microsoft Employee
    2021-03-09T15:58:28.14+00:00

    Hi @SSB ,

    It appears you're having the same issue as described in https://github.com/xamarin/xamarin-macios/issues/10548. The issue is still open, but I will see about getting an update.

    Have you attempted using an offline install of a prior version? I see that installing previous versions of VS has been supported; https://developercommunity.visualstudio.com/t/please-provide-permanent-deterministic-public-link/353980, but not sure if it applies to VS on Mac. If you run into issues, I would suggest submitting feedback to the Visual Studio team.

    Regards,
    Ryan


  2. Jorge Rodriguez 1 Reputation point
    2021-06-01T05:17:06.38+00:00

    guys, it looks like working fine with v4.5.0 of System.Memory.

    <PackageReference Include="System.Memory">
      <Version>4.5.0</Version>
    </PackageReference>
    
    0 comments No comments