Skip to content

System.IO.FileNotFoundException: Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies #2037

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

Closed
MagicAndre1981 opened this issue Aug 3, 2018 · 4 comments

Comments

@MagicAndre1981
Copy link

Steps to Reproduce

  1. Create a Xamarim.Forms project (UWP, Android) with .net standard as shared code
  2. Install Microsoft.AspNetCore.SignalR.Client

Actual Behavior

In Android App, the await Connection.StartAsync(); of SignalR to start a connection fails with "System.IO.FileNotFoundException: Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies."

08-03 07:48:06.393 W/Mono    ( 1302): The following assembly referenced from System.Memory.dll could not be loaded:
08-03 07:48:06.393 W/Mono    ( 1302):      Assembly:   System.Numerics.Vectors    (assemblyref_index=1)
08-03 07:48:06.393 W/Mono    ( 1302):      Version:    4.1.3.0
08-03 07:48:06.393 W/Mono    ( 1302):      Public Key: b03f5f7f11d50a3a
08-03 07:48:06.393 W/Mono    ( 1302): The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/).
08-03 07:48:06.393 D/Mono    ( 1302): Failed to load assembly System.Memory[0x9da780a0].
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Debug: Waiting for the application to finish sending data.
Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport: Debug: Socket closed.
Microsoft.AspNetCore.SignalR.HubConnectionHandler: Debug: OnConnectedAsync ending.
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets: Debug: Connection id "0HLFP0IGPDAVO" received FIN.
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets: Debug: Connection id "0HLFP0IGPDAVN" received FIN.
Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager: Debug: Removing connection KuVd5kZmt9QK6q9jGb6mjw from the list of connections.
Microsoft.AspNetCore.Server.Kestrel: Debug: Connection id "0HLFP0IGPDAVO" disconnecting.
Microsoft.AspNetCore.Hosting.Internal.WebHost: Information: Request finished in 1923.6471ms 101 
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets: Debug: Connection id "0HLFP0IGPDAVO" sending FIN.
Microsoft.AspNetCore.Server.Kestrel: Debug: Connection id "0HLFP0IGPDAVN" disconnecting.
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets: Debug: Connection id "0HLFP0IGPDAVN" sending FIN.
Microsoft.AspNetCore.Server.Kestrel: Debug: Connection id "0HLFP0IGPDAVN" stopped.
Microsoft.AspNetCore.Server.Kestrel: Debug: Connection id "0HLFP0IGPDAVO" stopped.
Thread finished: <Thread Pool> #5
The thread 0x5 has exited with code 0 (0x0).
The thread 0x1f0c has exited with code 0 (0x0).
[0:] System.IO.FileNotFoundException: Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
  at System.MemoryExtensions.IndexOf[T] (System.ReadOnlySpan`1[T] span, T value) [0x00035] in <f6dad3dbe4c6408e8a0f6ade27956b1c>:0 
  at System.Buffers.BuffersExtensions.PositionOf[T] (System.Buffers.ReadOnlySequence`1[T]& source, T value) [0x00016] in <f6dad3dbe4c6408e8a0f6ade27956b1c>:0 
  at Microsoft.AspNetCore.Internal.TextMessageParser.TryParseMessage (System.Buffers.ReadOnlySequence`1[System.Byte]& buffer, System.Buffers.ReadOnlySequence`1[System.Byte]& payload) [0x00000] in <6681a6abc96148a6852dee9a5e081e84>:0 
  at Microsoft.AspNetCore.SignalR.Protocol.HandshakeProtocol.TryParseResponseMessage (System.Buffers.ReadOnlySequence`1[System.Byte]& buffer, Microsoft.AspNetCore.SignalR.Protocol.HandshakeResponseMessage& responseMessage) [0x00000] in <6681a6abc96148a6852dee9a5e081e84>:0 
  at Microsoft.AspNetCore.SignalR.Client.HubConnection+<HandshakeAsync>d__45.MoveNext () [0x002c5] in <2fa773d5c6ab4e6a98db7380798c1d64>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at Microsoft.AspNetCore.SignalR.Client.HubConnection+<StartAsyncCore>d__31.MoveNext () [0x001d2] in <2fa773d5c6ab4e6a98db7380798c1d64>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at Microsoft.AspNetCore.SignalR.Client.HubConnection+<StartAsyncCore>d__31.MoveNext () [0x00298] in <2fa773d5c6ab4e6a98db7380798c1d64>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in <2fa773d5c6ab4e6a98db7380798c1d64>:0 
  at Microsoft.AspNetCore.SignalR.Client.HubConnection+<StartAsync>d__24.MoveNext () [0x00076] in <2fa773d5c6ab4e6a98db7380798c1d64>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at Foo.App.Services.Provider.SignalRAspNetCoreProvider+<Connect>d__10.MoveNext () [0x00056]

Expected Behavior

the await Connection.StartAsync(); of SignalR to start a connection should work fine just like in UWP

Version Information

Microsoft Visual Studio Enterprise 2017
Version 15.7.5
VisualStudio.15.Release/15.7.5+27703.2042
Microsoft .NET Framework
Version 4.7.03062

Xamarin 4.10.10.2 (35a01d8dc)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.12.1 (f3257e429)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Live Reload 0.4.0 (remotes/origin/dev@75526a0)
Provides live reload capabilities for Xamarin XAML.

Xamarin.Android SDK 8.3.3.2 (HEAD/dffc59120)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 11.12.0.4 (64fece5)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Log File

C:\Program Files (x86)\Android\android-sdk> adb logcat -d | pbcopy
Der Befehl "pbcopy" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

@MagicAndre1981
Copy link
Author

I found a similar issue and added the AutoGenerateBindingRedirects entry to the Android csproj, but I still get the same issue.

Next I tried to add the System.Memory and System.Numerics.Vectors NuGet packages on my own to the app, but this also doesn't fix the exception.

@MagicAndre1981
Copy link
Author

I just got the update to 15.7.6, but this also doesn't fix it. Next I've added the option CopyLocalLockFileAssemblies so that the NuGet files should be copied to output folder and I see Memory and Numerics dll in obj\AnyCPU\android\assets but still the same exception.

The dependency comes from SignalR :

Microsoft.AspNetCore.Connections.Abstractions depends on System.IO.Pipelines, which depends on System.Memory for .Net Standard 2.0, but not for MonoAndroid 1.0.

What should I do now? 🤔🤷‍♂️

@MagicAndre1981
Copy link
Author

ok, looks like I need to wait for final of Visual Studio 2017 15.8

In order to use the SignalR Client in Xamarin applications you will need to:

Xamarin.Android 8.4.0.1
These will be included in:

Visual Studio 15.8 Preview 3 

@MagicAndre1981
Copy link
Author

works with 15.8 Preview 5

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

1 participant