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

Xamarin support tracking issue #1886

Closed
davidfowl opened this issue Apr 6, 2018 · 114 comments
Closed

Xamarin support tracking issue #1886

davidfowl opened this issue Apr 6, 2018 · 114 comments
Assignees
Labels
cost: 0 Will take no time. This is a tracking issue
Milestone

Comments

@davidfowl
Copy link
Member

davidfowl commented Apr 6, 2018

There's a bunch of work that is planned but that is also required to make SignalR work. There is an issue in System.Memory preventing it from being used in Xamarin applications. This issue is tracking the work that is being done in corefx to remedy the situation.

@analogrelay
Copy link
Contributor

We also need to determine our plan for MsgPack in Xamarin. If we support it in the initial release, we need to make sure it's configured appropriately to not use Reflection.Emit.

@analogrelay analogrelay added the cost: 0 Will take no time. This is a tracking issue label Apr 9, 2018
@analogrelay analogrelay added this to the 2.1.0-rc1 milestone Apr 9, 2018
@muratg muratg modified the milestones: 2.1.0-rc1, 2.1.0 Apr 11, 2018
@analogrelay
Copy link
Contributor

Most of these PRs are closed, are they in a public build or can we get some access to a build that has these fixes to test out? @davidfowl

@elusiven
Copy link

Is there an actual version that actually works? Trying to get this to work but getting system.memory error all the time.

@davidfowl
Copy link
Member Author

/cc @migueldeicaza

@digitalkirkley
Copy link

I have the same "system.memory" issue on Xamarin Android (.NET Standard) project using AspNetCore.SignalR.Client. Is there any further update on this please? (I can make progress using UWP)

@digitalkirkley
Copy link

I found to get Android building, directly reference: system.memory
Then to get running, copy over to debug/Android/assets at post build time:
system.io.pipelines, system.threading.tasks.extensions, system.buffers, system.runtime.compilerservices.unsafe

@FrancoisM
Copy link

Version="1.0.0-preview2-final" doesn't build for iOS project on VS 2017 15.6.6

Failed to resolve "System.Buffers.IBufferWriter`1" reference from "System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"

@muratg
Copy link

muratg commented May 4, 2018

@mikaelm12 Did you get a chance to look into this yet?

@mikaelm12
Copy link
Contributor

@muratg I'd need access to a build with these fixes

@muratg muratg modified the milestones: 2.1.0, 2.2.0-mq May 4, 2018
@muratg
Copy link

muratg commented May 4, 2018

@mikaelm12 sounds good, punting the verification out of the milestone.

@analogrelay
Copy link
Contributor

I really hope so, but @anurse also said that SignalR 1.0.1 should fix build time problems

To clarify, it solves IL build-time issues, however iOS requires ahead-of-time native compilation and it will fail there.

@shkaan
Copy link

shkaan commented Jun 25, 2018

Got it, will wait for Xamarin update.

@reznor244
Copy link

reznor244 commented Jun 27, 2018

I've updated to Visual Studio 2017 15.8 Preview 3 which includes Xamarin.Android 8.4.0.1 and Xamarin.iOS 11.14.0.4, installed Microsoft.AspNetCore.SignalR.Client and Microsoft.AspNetCore.SignalR.Client.Core 1.0.1 and am still getting this error when trying to build my Android app on Xamarin Forms. I've not yet tried iOS as I don't want to update Xamarin.iOS on my build Mac to a preview version.

@eopeter
Copy link

eopeter commented Jun 27, 2018

After updating to all the latest bits as suggested to fix the issue by @anurse , I was still having issue and the fix for me was to create a new project and copy files over. (was a pain but works after that)

@eopeter
Copy link

eopeter commented Jun 27, 2018

Maybe delete all packages from project and reopen the project may be a quicker way to get all fresh libraries but didn't try it

@analogrelay
Copy link
Contributor

@reznor244 did you also install the additional dependencies listed in aspnet/Announcements#305 ?

@eopeter Hrm, I wouldn't have thought you'd have to recreate the project. I didn't have to do that, but I had a very simple test project. Glad it did work out in the end...

@reznor244
Copy link

@anurse No, I had not seen that announcement. I installed them just now and am still receiving the same build error. I created a new Xamarin Forms project and installed all the packages and still cannot build the Android app. I get 4 "Can not resolve reference: 'System.Threading.Tasks.Extensions'" build errors even though I have installed v4.5.1 on both the SignalR client project and Android app project.

I also tried installing the SignalR.Client and other dependencies directly on the Android project rather than a separate project. Same errors.

@analogrelay
Copy link
Contributor

Can you provide you obj/project.assets.json file and the PackageReference nodes in your csproj? Please post them to a gist or something similar and link them as the files are quite large. Also note that these will include all Package IDs and Versions you are referencing so if there's any sensitive information in that, you should filter it out before posting it.

@reznor244
Copy link

These are from a fresh test project I created to try to see if I could get it to build, so no sensitiveinfo.

TestSignalRClient.csproj: https://gist.github.com/reznor244/2f5bcac412060400c5b0119d75925f9a
TestSignalRClient.Android.csproj: https://gist.github.com/reznor244/e80bc2339dcb37f67f32a69e1c61ed9d
project.assets.json (from TestSignalRClient): https://gist.github.com/reznor244/798a3f1fc89dd98d2d5d51fb376fcee3

@analogrelay
Copy link
Contributor

analogrelay commented Jun 27, 2018

Hrm, I'm not able to reproduce this with our Xamarin.Forms client sample.

Can you push your test project up to a GitHub repo and open a new issue for this? I want to try reproducing this with exactly the same project you are. Please also include your Xamarin versions so I can compare them with the ones I'm using.

@MagicAndre1981
Copy link

With 1.0.2 I get System.IO.FileNotFoundException: Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.3.0 on Android with Xamarin. The UWP Xamarin project works fine.

@MagicAndre1981
Copy link

ok, I just saw the announcement and need to wait for 15.8 update to get it working.

@marchanddesable
Copy link

15.8.0 Preview 4.0 is released

@MagicAndre1981
Copy link

@marchanddesable there is already Preview 5, but I don't want to install a Preview, I want a stable version.

@MagicAndre1981
Copy link

ok, the 15.8 Preview 5 works. So I wasted some time to figure this out.

@anurse

The docs are wrong until 15.8 gets out:

The ASP.NET Core SignalR .NET client can be used by Xamarin

Because of this statement I did not expect my issue.

@ChizuNoYama
Copy link

Any update on this since 15.8.1 is out now? I don't want to update just yet because last time I did, Xamarin.iOS wasn't working at the time and I had to uninstall VS, resulting in losing my keystore.

@MagicAndre1981
Copy link

@Titonton 15.8.1 works for Android if I use packages.config. I can't speak about iOS.

@reznor244
Copy link

I was able to use it with iOS on a shared project. I was unable to get it to work on .NET Standard 2.0 because mtouch would fail to link Systems.Threading.Tasks.Extensions 4.5.1 because of some reference issues (see xamarin-macos issue #4629). There may be a work around, but I stripped out the feature requiring SignalR (business decision to put the new feature on hold). Hopefully that is resolved in next update.

@KSemenenko
Copy link

Remove the app.config from the project. It helped me for Xamarin.iOS and Xamarin.Andoird

@BillyMutt
Copy link

Based on the info here aspnet/Announcements#305 I was hoping to finally get my Xamarin iOS client working with ASP.Net Core SignalR, but still no luck. I get an exception when the client tries to connect to the hub:

//  Connect to the SignalR hub.
string url = $"http://{DataService.HostName}:{DataService.MainPort.ToString()}/hub";
try
{
    MediaHubConnection = new HubConnectionBuilder().WithUrl(url).Build();
}
catch (Exception e)
{ // Handle exception }

Exception: A suitable constructor for type Microsoft.AspNetCore.SignalR.Client.HttpConnectionFactory could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.

The code above works in the iPhone simulator, but crashes on the device itself.

I am using Visual Studio 15.8.0 with Xamarin iOS 11.14.0.13 on Windows 10; Visual Studio for Mac 7.6.1 Build 9 with Xamarin iOS 11.14.0.13 on the Mac. Latest released Nugets for AspNetCore SignalR (server and client).

Any help is highly appreciated.

@BillyMutt
Copy link

Just to close the loop: more info here. Much thanks to @anurse for helping out.

@rs1t
Copy link

rs1t commented Sep 26, 2018

@anurse Hey! Is there any way to use SignalR Client 1.0.0-preview1-final in Xamarin? Exactly this version is used on server and I can't affect this.

If I set linker behavior to Don't link then I'll get runtime exception:
Could not load type of field 'Microsoft.AspNetCore.Sockets.Client.ServerSentEventsTransport:_memoryPool' (0) due to: Could not resolve type with token 01000064 (from typeref, class/assembly System.Buffers.MemoryPool, System.IO.Pipelines, Version=0.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) assembly:System.IO.Pipelines, Version=0.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 type:System.Buffers.MemoryPool member:(null) signature:<none> after calling hubConnection.StartAsync(). There are no compile errors, though.

But if I use Link All I will get build time error:
Error MT2101: Can't resolve the reference 'System.Void System.Buffers.MemoryPool::.ctor()', referenced from the method 'System.Void Microsoft.AspNetCore.Sockets.Client.ServerSentEventsTransport::.cctor()' in 'System.IO.Pipelines, Version=0.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. (MT2101) (Coinlion.iOS)
or with Link framework SDKs only:
error MT2002: Failed to resolve "System.IO.Pipelines.PipeReader" reference from "System.IO.Pipelines, Version=0.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60"

There is part of my Link framework SDKs only build log with additional -v -v -v -v mtouch arguments (unrelated info removed):
https://gist.github.com/rs1t/4cb71af7750bb9c34a40a63105f5c776
And packages.config:
https://gist.github.com/rs1t/1fe3be9ee801a2d4858c400db43d8131

I have latest VS Mac and Xamarin versions (the issue was present with earlier versions as well):

=== Visual Studio Community 2017 for Mac ===

Version 7.6.7 (build 49)
Installation UUID: 82d8c3be-5d15-42ff-b578-d2b5bb3b8c97
Runtime:
Mono 5.12.0.301 (2018-02/4fe3280bba1) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

Package version: 512000301

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.1.2
SDK: /usr/local/share/dotnet/sdk/2.1.302/Sdks
SDK Version: 2.1.302
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.3
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 10.0 (14320.25)
Build 10A255

=== Xamarin.Mac ===

Version: 4.6.0.14 (Visual Studio Community)
Hash: 1a6e2786
Branch:
Build date: 2018-08-28 00:12:06-0400

=== Xamarin.iOS ===

Version: 12.0.0.15 (Visual Studio Community)
Hash: 84552a46
Branch: xcode10
Build date: 2018-09-17 21:54:33-0400

=== Xamarin.Android ===

Version: 9.0.0.20 (Visual Studio Community)
Android SDK: /Users/ddrobotov/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.2 (API level 17)
4.4 (API level 19)
7.1 (API level 25)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.1
SDK Build Tools Version: 27.0.3

Java SDK: /usr
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 706070049
Git revision: 0b48ccfb376397678b3bc3653da2c6603d35357d
Build date: 2018-09-20 21:14:23+00
Build branch: release-7.6
Xamarin extensions: b25fd1e2b9a7859aff9536924e8edb6cbfb78637

=== Operating System ===

Mac OS X 10.13.6
Darwin 17.7.0 Darwin Kernel Version 17.7.0
Fri Jul 6 19:54:51 PDT 2018
root:xnu-4570.71.3~2/RELEASE_X86_64 x86_64

@MagicAndre1981
Copy link

@rs1t
why not update the server and client to last stable version?

@davidfowl
Copy link
Member Author

@anurse Hey! Is there any way to use SignalR Client 1.0.0-preview1-final in Xamarin? Exactly this version is used on server and I can't affect this.

Nope. Preview1 is a preview for a reason, things changed, bugs were fixed you can't go back in time to use old preview versions, they are unsupported (and frankly probably buggy).

@rs1t
Copy link

rs1t commented Sep 26, 2018

@MagicAndre1981 @davidfowl
My backend dev says that there are problems with error handling in new SignalR, for example instead of "user not found" we get "generic error" which causes problems with tests. And this app is not the only client, so the whole update may take a while.
My point is that it would be great if I can change the client only, maybe I just need to fix some dependencies or work with linking? I would really appreciate any help here.

@analogrelay
Copy link
Contributor

Nope, the preview builds had critical issues that prevented them from working with Xamarin. We fixed this in the final client release.

My backend dev says that there are problems with error handling in new SignalR, for example instead of "user not found" we get "generic error" which causes problems with tests.

Please file these issues and we can look at resolving them.

@rs1t
Copy link

rs1t commented Sep 26, 2018

Ok, thanks! I'll mention it to my backend team.

@davidfowl
Copy link
Member Author

davidfowl commented Sep 26, 2018

My backend dev says that there are problems with error handling in new SignalR, for example instead of "user not found" we get "generic error" which causes problems with tests. And this app is not the only client, so the whole update may take a while.

That's always been the case, leaking errors to the client is a security problem, you can EnableDetailedErrors to show the actual error but that really has nothing to do with this issue. I suggest you open another one if you're having a different problem.

My point is that it would be great if I can change the client only, maybe I just need to fix some dependencies or work with linking? I would really appreciate any help here.

You can change the client only but you can't use preview versions after we've shipped the final one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cost: 0 Will take no time. This is a tracking issue
Projects
None yet
Development

No branches or pull requests