-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.AspNetCore.SignalR.Client is not working with Xamarin.Mac application #1460
Comments
Looks like System.Text.Json is not working in Xamarin.Mac? @ahsonkhan @marek-safar any thoughts from your respective sides here? (Since it came up in Triage, the .NET Core version info isn't necessarily relevant here because this is a Xamarin.Mac app using the SignalR Client via NuGet. Just in case any other viewers of this issue get worried by the "preview3" branding references) |
I'm going to move this to dotnet/runtime for now. It looks like this is an issue in System.Text.Json on Xamarin.Mac and not specific to ASP.NET Core SignalR |
FindFirstCharacterToEncodeUtf8 was a new API that was added during 3.0. For this error to occur it means you must be using an old copy of System.Text.Encodings.Web. Can you double check that you are referencing package version It's possible you downgraded that dependency and suppressed a warning about the downgrade. If the package reference looks correct, you can double check that the API is present in that nuget package. If it is, then follow up with Xamarin.Mac owners about why they don't honor that package. For many .NET packages Xamarin tooling ignores the assembly in preference of their own, but this should not be one of them. /cc @mhutch |
I took a closer look at this with @ahsonkhan who had VS for Mac and we could debug. It turns out this is happening because the Xamarin.Mac project is allowing the System.Memory dll from the package to win out over the framework copy. This causes System.Text.Json and System.Text.Encodings.Web to disagree on where ReadOnlySpan lives. System.Text.Json thinks it lives in System.Memory, which has a type definition. This results in the MissingMethodException since the runtime can't find the method on TextEncoder that takes a System.Memory-defined ROS. The bug here is that Xamarin.Mac isn't preferring it's own copy of System.Memory: it should, this is what .NETCoreApp does. The version of System.Memory in the package is 4.0.1.1, where the version in Xamarin.Mac is 4.0.99.0. I found a similar bug which is caused by the same root issue here: Closing this as a dup and adding my analysis. |
To workaround: If the project is using packages.config, then delete the |
I don't know if this is a similar issue but I'm getting the following error
I added a MacOS project to my existing Xamarin Forms (iOS) project and afgter going through all of the dependency issues and adding references from nuget, I get stuck with this one. The above workaround didn't work unfortunately. |
Describe the bug
Cannot build
HubConnection
due to exception:To Reproduce
Xamarin.Mac 2.0 (Modern)
Microsoft.AspNetCore.SignalR.Client
NuGet packageAppDelegate
:Further technical details
.NET Core version:
VS for Mac version:
Visual Studio Enterprise 2019 for Mac Version 8.3.10 (build 2)
Xamarin.Mac version:
Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)
Microsoft.AspNetCore.SignalR.Client NuGet version:
3.1.0
The text was updated successfully, but these errors were encountered: