Closed Tommigun1980 closed 3 years ago
After downgrading the Microsoft.AspNetCore.SignalR.Client package from 6.0.0-preview4 to preview1 again, and then cleaning the project and deleting bin and obj folders, things started to work again. So https://github.com/dotnet/aspnetcore/issues/33269 seems to be the correct destination for this report, and it breaking after the update of VS was just coincidental. I will file a separate bug report about VS For Mac sometimes requiring deleting said folders before package changes are reflected, and will follow up on the issue in the ASP.NET Core repo.
Closing this report now that the root cause was found. Thank you.
Closing.
When VS For Mac is updated to the latest stable version (8.10), Microsoft.AspNetCore.SignalR.Client no longer works in a Xamarin.Forms (iOS) project if the linker is enabled. Microsoft.AspNetCore.SignalR.Client version doesn't seem to matter, I tried 6.0.0-preview4, 6.0.0-preview3, and 5.0.6. Everything was working properly until VS For Mac was updated and it updated Mono/Xamarin-macios.
Because of this I also filed the bug report at https://github.com/mono/mono/issues/21093 and https://github.com/dotnet/aspnetcore/issues/33269 as I don't know whether it belongs in the ASP.Net/SignalR, Xamarin-MacIOS or Mono issues category.
Steps to Reproduce
System.InvalidOperationException: A suitable constructor for type 'Microsoft.Extensions.Options.UnnamedOptionsManager'1[Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionOptions]' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
".Please note that this started to happen only when I updated VS For Mac (8.10), and that the crash only happens if linking is enabled. The full stack trace is as follows:
The code it complains about, HubConnectionBuilder.Build, will crash even with an empty connection builder:
Please note that this is a Xamarin.Forms project, in case it has any bearing on anything.
It goes without saying that this is a catastrophic failure and I'd really appreciate a fix. Thank you.
Expected Behavior
When linking is enabled, it should still work.
Actual Behavior
When the incorrectly stripped code is run, the app crashes.
Environment
Stacktrace