Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Need Xamarin Client #1238

Closed
MhAllan opened this issue Dec 20, 2017 · 27 comments
Closed

Need Xamarin Client #1238

MhAllan opened this issue Dec 20, 2017 · 27 comments
Milestone

Comments

@MhAllan
Copy link

MhAllan commented Dec 20, 2017

I am having errors (Android crashes) when adding Microsoft.AspNetCore.SignalR.Client reference.
The error is : "Could not load assembly 'System.Memory' during startup registration"

I don't know if monodroid needs to update or your client should be Standard than Core?

@VladimirAkopyan
Copy link

Can;t seem to find source for that package on gitub. Am I being dumb? Can someone point me to it?

@MhAllan
Copy link
Author

MhAllan commented Dec 22, 2017

@VladimirAkopyan it is still preview, check the "Include Prerelease" checkbox of your VS NuGet manager

@VladimirAkopyan
Copy link

I meant that I could not find the source code of this package on github - I want to take a look at the source. Is it in a folder in this repo?

@nikolayDemirev
Copy link

nikolayDemirev commented Dec 27, 2017

I have the same issue with SignalR on Xamarin.Android:

12-27 19:16:50.510 D/Mono (10799): Assembly Loader probing location: 'System.Memory'.
12-27 19:16:50.510 F/monodroid-assembly(10799): Could not load assembly 'System.Memory' during startup registration.
12-27 19:16:50.510 F/monodroid-assembly(10799): This might be due to an invalid debug installation.
12-27 19:16:50.510 F/monodroid-assembly(10799): A common cause is to 'adb install' the app directly instead of doing from the IDE.

It runs on Xamarin.iOS and Xamarin.UWP, but Xamarin.Android gives that error and the app crashes just after showing the SplashScreen. Even without using any SignalR class.

@VishalMadhvani
Copy link

@nikolayDemirev
Copy link

nikolayDemirev commented Dec 28, 2017

I was able to fix the error related to System.Memory, by installing manually System.Memory 4.4.0-preview2-25405-01 nuget from a local source, because I could not find it in nuget.org source. I have the "Include prerelease" option enabled. After that I got a new error:

12-28 12:44:39.016 F/monodroid-assembly( 6004): Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration.
12-28 12:44:39.016 F/monodroid-assembly( 6004): This might be due to an invalid debug installation.
12-28 12:44:39.016 F/monodroid-assembly( 6004): A common cause is to 'adb install' the app directly instead of doing from the IDE.

I have tried to install that nuget from a local source the same way as System.Memory but that did not help.

@nikolayDemirev
Copy link

I was able to fix the error related to System.Memory, by installing manually System.Memory 4.4.0-preview2-25405-01 nuget from a local source, because I could not find it in nuget.org source. I have the "Include prerelease" option enabled. After that I got a new error:

12-28 12:44:39.016 F/monodroid-assembly( 6004): Could not load assembly 'System.Runtime.CompilerServices.Unsafe' during startup registration.
12-28 12:44:39.016 F/monodroid-assembly( 6004): This might be due to an invalid debug installation.
12-28 12:44:39.016 F/monodroid-assembly( 6004): A common cause is to 'adb install' the app directly instead of doing from the IDE.

I have tried to install that nuget from a local source the same way as System.Memory but that did not help.

I was able to fix this by manually copying the System.Runtime.CompilerServices.Unsafe.dll from the nuget package to obj\Debug\android\assets folder. But this is not very good.

Can anyone help how to make it work without hacks?

@MhAllan
Copy link
Author

MhAllan commented Dec 29, 2017

@nikolayDemirev Thanks a lot, to summarise: what works is copying the "System.Memory" and "System.Runtime.CompilerServices.Unsafe" to" \obj\Debug\android\assets"

@analogrelay
Copy link
Contributor

What version of SignalR are you using? The current version of SignalR may depend on some pre-release bits of the .NET MyGet feeds, so you may need to add those as NuGet sources to get the right packages.

@MhAllan
Copy link
Author

MhAllan commented Jan 6, 2018

@anurse I am using Microsoft.AspNetCore.SignalR version 1.0.0-alpha2-final

@spolezhaev
Copy link

@MhAllan So what exactly we should copy? Dll or what? If Dll where do i get it?

@MhAllan
Copy link
Author

MhAllan commented Jan 7, 2018

@Piteryo Yes Dlls. You can get them by Nuget having "Include prerelease" checkbox checked. then you will find them in ".nuget" folder in C:\Users\Your_User

Or these I attached

Signalr-Xam-Droid.zip

@mikaelm12
Copy link
Contributor

Is anyone still seeing this issue with 1.0.0-alpha2-final version of Microsoft.AspNetCore.SignalR.Client ? I was able to install and use it in a Xamarin Android project without any issues.

@ghost
Copy link

ghost commented Jan 21, 2018

Yes I have exactly the same issue. This is a blocker for my project right now.

@mikaelm12
Copy link
Contributor

@w2k Are you using 1.0.0-alpha2-final version of the client? What version of the runtime are you using?

@MhAllan
Copy link
Author

MhAllan commented Jan 28, 2018

@mikaelm12 , yes the issue is in 1.0.0-alpha2-final .. please note we are talking about Xamarin Forms solution (I didn't try with Xamarin Android solution). could you upload your android solution so I can see the difference. for me if I don't manually include "System.Memory" and "System.Runtime.CompilerServices.Unsafe" in " \obj\Debug\android\assets" it doesn't work. I came back to it today updated whatever needs to update today and tried again, same issue without that manually copy of dlls

@davidfowl
Copy link
Member

@MhAllan are you using the latest Xamarin Android version?

@mikaelm12
Copy link
Contributor

@MhAllan
Copy link
Author

MhAllan commented Feb 2, 2018

Hi @mikaelm12 , Thanks for the example. The problem is in Xamarin Forms Android, the difference is that your project is using packages.config while Xamarin form is using packagereference. I don't know why this packagereference is skipping dependencies, I guess they are supposed to be in the runtime but monodroid doesn't have them. You just start a xamarin forms solution, add the signalr client to the android and that android won't be able to load the dependencies i mentioned

@davidfowl
Copy link
Member

@MhAllan What version of Xamarin Android are you using?

@MhAllan
Copy link
Author

MhAllan commented Feb 3, 2018

@davidfowl , it is Android 8.0, but those Mono.Android dlls are all versioned 0.

image

@MhAllan
Copy link
Author

MhAllan commented Feb 3, 2018

Here is the solution, connect to android and launch it, it will crash. I am connecting to Android 6 Samsung device

SignalrTest.zip

@nikolayDemirev
Copy link

Hi, do we still have to copy the binaries manually in order to make it work?

@MhAllan
Copy link
Author

MhAllan commented Feb 14, 2018

@nikolayDemirev I believe we still have to do so until these binaries are out with .net core 2.1 and get included in mono

@muratg muratg added this to the Discussions milestone Feb 20, 2018
@Hazzamanic
Copy link

Any news on when we might see support for signalr in android forms projects?

@ConfusedTA
Copy link

Experiencing the same issue with a brand new install of Windows, VS Preview, .NET Core, and SignalR - even manually copying the System.Memory and System.Runtime.CompilerServices.Unsafe DLLs into the debug folder prior to build/deployment is failing. The splash screen will appear, then the app will crash. Deployment also takes an excruciatingly long time.

@davidfowl
Copy link
Member

Closing see #1886

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests