Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by boulos77 · Nov 12, 2020 at 04:31 PM · androidiosdll error

Using SignalR client in Android/iOS app

I'm trying to use my mobile application (for Android and iOS) as a SignalR client built with Unity3d version 2019.2.9f1 (I have also tried with 2019.4.0f1 with no difference).

I began by downloading the latest version of the AspNetCore SignalR client from nuget and extracting the dll. I placed this in my Plugins folder, and repeated the process for each of its dependencies, getting the latest version of each from nuget.

I included a link.xml file to preserve each of the assemblies in that same folder:

 <linker>
  <assembly fullname="Microsoft.AspNetCore.Connections.Abstractions" preserve="all"/>
  <assembly fullname="Microsoft.AspNetCore.Http.Connections.Client" preserve="all"/>
  <assembly fullname="Microsoft.AspNetCore.Http.Connections.Common" preserve="all"/>
  <assembly fullname="Microsoft.AspNetCore.Http.Features" preserve="all"/>
  <assembly fullname="Microsoft.AspNetCore.SignalR.Client.Core" preserve="all"/>
  <assembly fullname="Microsoft.AspNetCore.SignalR.Client" preserve="all"/>
  <assembly fullname="Microsoft.AspNetCore.SignalR.Common" preserve="all"/>
  <assembly fullname="Microsoft.AspNetCore.SignalR.Protocols.Json" preserve="all"/>
  <assembly fullname="Microsoft.Extensions.DependencyInjection.Abstractions" preserve="all"/>
  <assembly fullname="Microsoft.Extensions.DependencyInjection" preserve="all"/>
  <assembly fullname="Microsoft.Extensions.Logging.Abstractions" preserve="all"/>
  <assembly fullname="Microsoft.Extensions.Logging" preserve="all"/>
  <assembly fullname="Microsoft.Extensions.Options" preserve="all"/>
  <assembly fullname="Microsoft.Extensions.Primitives" preserve="all"/>
  <assembly fullname="System.Buffers" preserve="all"/>
  <assembly fullname="System.ComponentModel.Annotations" preserve="all"/>
  <assembly fullname="Microsoft.Bcl.AsyncInterfaces" preserve="all"/>
  <assembly fullname="System.Diagnostics.DiagnosticSource" preserve="all"/>
  <assembly fullname="System.IO.Pipelines" preserve="all"/>
  <assembly fullname="System.Memory" preserve="all"/>
  <assembly fullname="System.Text.Encodings.Web" preserve="all"/>
  <assembly fullname="System.Runtime.CompilerServices.Unsafe" preserve="all"/>
  <assembly fullname="System.Text.Json" preserve="all"/>
  <assembly fullname="System.Threading.Channels" preserve="all"/>
  <assembly fullname="System.Threading.Tasks.Extensions" preserve="all"/>
 </linker>

And my client code:

 using Microsoft.AspNetCore.SignalR.Client;
 using System;
 using UnityEngine;
 
 public class SignalRManager : MonoBehaviour
 {
     public static HubConnection myConnection;
 
     public void StartSignalConnection()
     {
         try
         {
             Debug.Log("Before building");
             myConnection = new HubConnectionBuilder().WithUrl("ServerURL").Build();
             Debug.Log("After building");
 
             myConnection.On<string>("MessageClient", message =>
             {
                 Debug.Log("From signalR: " + message);
             });
 
             myConnection.StartAsync();
         }
         catch (Exception ex) { Debug.Log("My error caught here: " + ex.ToString()); }
     }
 
     public void SendMessage()
     {
         if (myConnection.State != HubConnectionState.Connected) { Debug.Log("Not connected yet"); return; }
 
         myConnection.InvokeAsync("MessageClient", "Test message");
     }
 }



In the editor, all of the above works perfectly. I press a button in my scene and it starts the connection, and I press another button and a message is sent. Once I build to my Android device and try to start the connection, I get the following when I reach the .build() statement:

 2020/11/11 10:13:46.980 20848 28520 Warn Unity Plugins: Couldn't open advapi32, error: dlopen failed: library "advapi32" not found
 2020/11/11 10:13:46.980 20848 28520 Warn Unity Microsoft.Win32.ManifestEtw:EventRegister(Guid&, EtwEnableCallback, Void*, Int64&)
 2020/11/11 10:13:46.980 20848 28520 Warn Unity System.Diagnostics.Tracing.EventProvider:Register(Guid)
 2020/11/11 10:13:46.980 20848 28520 Warn Unity System.Diagnostics.Tracing.EventSource:Initialize(Guid, String, String[])
 2020/11/11 10:13:46.980 20848 28520 Warn Unity Microsoft.Extensions.DependencyInjection.DependencyInjectionEventSource:.cctor()
 2020/11/11 10:13:46.980 20848 28520 Warn Unity Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine:CreateServiceAccessor(Type)
 2020/11/11 10:13:46.980 20848 28520 Warn Unity System.Func`2:Invoke(T)
 2020/11/11 10:13:46.980 20848 28520 Warn Unity System.Collections.Concurrent.ConcurrentDictionary`2:GetOrAdd(TKey, Func`2)
 2020/11/11 10:13:46.980 20848 28520 Warn Unity Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine:GetService(Type, ServiceProviderEngineScope)
 2020/11/11 10:13:46.980 20848 28520 Warn Unity Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions:GetService(IServiceProvider)
 2020/11/11 10:13:46.980 20848 28520 Warn Unity Microsoft.AspNetCore.SignalR.Client.HubConnectionBuilder:Build()
 2020/11/11 10:13:46.980 20848 28520 Warn Unity SignalR:StartSignalRConnection()
 2020/11/11 10:13:46.980 20848 28520 Warn Unity UnityEngine.Events.UnityAction:Invoke()
 2020/11/11 10:13:46.980 20848 28520 Warn Unity UnityEngine.Events.UnityEvent:Invoke()
 2020/11/11 10:13:46.980 20848 28520 Warn Unity UnityEngine.EventSystems.EventFunction
 
 2020/11/11 10:13:47.027 20848 28520 Warn Unity Plugins: Couldn't open advapi32, error: dlopen failed: library "advapi32" not found
 2020/11/11 10:13:47.027 20848 28520 Warn Unity Microsoft.Win32.ManifestEtw:EventRegister(Guid&, EtwEnableCallback, Void*, Int64&)
 2020/11/11 10:13:47.027 20848 28520 Warn Unity System.Diagnostics.Tracing.EventProvider:Register(Guid)
 2020/11/11 10:13:47.027 20848 28520 Warn Unity System.Diagnostics.Tracing.EventSource:Initialize(Guid, String, String[])
 2020/11/11 10:13:47.027 20848 28520 Warn Unity System.Buffers.ArrayPoolEventSource:.cctor()
 2020/11/11 10:13:47.027 20848 28520 Warn Unity System.Buffers.DefaultArrayPool`1:Rent(Int32)
 2020/11/11 10:13:47.027 20848 28520 Warn Unity System.Text.Json.JsonEncodedText:TranscodeAndEncode(ReadOnlySpan`1, JavaScriptEncoder)
 2020/11/11 10:13:47.027 20848 28520 Warn Unity System.Text.Json.JsonEncodedText:Encode(ReadOnlySpan`1, JavaScriptEncoder)
 2020/11/11 10:13:47.027 20848 28520 Warn Unity System.Text.Json.JsonEncodedText:Encode(String, JavaScriptEncoder)
 2020/11/11 10:13:47.027 20848 28520 Warn Unity Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol:.cctor()
 2020/11/11 10:13:47.027 20848 28520 Warn Unity System.Reflection.MonoCMethod:InternalInvoke(Object, Object[])
 2020/11/11 10:13:47.027 20848 28520 Warn Unity Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver:VisitConstructor(ConstructorCallSite, RuntimeResolverContext)
 2020/11/11 10:13:47.027 20848 28520 Warn Unity Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver:VisitCache(ServiceCallSite, RuntimeResolverContext, ServiceP
 
 2020/11/11 10:13:47.471 20848 28520 Warn Unity Plugins: Couldn't open advapi32, error: dlopen failed: library "advapi32" not found
 2020/11/11 10:13:47.471 20848 28520 Warn Unity Microsoft.Win32.ManifestEtw:EventRegister(Guid&, EtwEnableCallback, Void*, Int64&)
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Diagnostics.Tracing.EventProvider:Register(Guid)
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Diagnostics.Tracing.EventSource:Initialize(Guid, String, String[])
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Net.NetEventSource:.cctor()
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Net.WebSockets.ClientWebSocket:.ctor()
 2020/11/11 10:13:47.471 20848 28520 Warn Unity Microsoft.AspNetCore.Http.Connections.Client.HttpConnection:IsWebSocketsSupported()
 2020/11/11 10:13:47.471 20848 28520 Warn Unity Microsoft.AspNetCore.Http.Connections.Client.Log:ErrorWithNegotiation(ILogger, Uri, Exception)
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Threading.ContextCallback:Invoke(Object)
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Runtime.CompilerServices.MoveNextRunner:Run()
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Action:Invoke()
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Threading.ContextCallback:Invoke(Object)
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Threading.Tasks.AwaitTaskContinuation:RunCallback(ContextCallback, Object, Task&)
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Threading.Tasks.Task:FinishContinuations()
 2020/11/11 10:13:47.471 20848 28520 Warn Unity System.Threading.Tasks.Task`1:TrySetResult(TResult)
 2020/11/11 10:13:47.471 20848 28520 Warn Unity Syste

I can see why the error is happening, but I'm not sure how to get around it. I believe the Libraries are using advapi32 to access some data from the registry (possibly the date and time for use in logging from what I've seen when researching this issue).

I tried adding in the dll and including it in my link.xml, but there was no change in behavior. My project is currently set to use an IL2CPP scripting backend with .NET 4.x compatibility.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by boulos77 · Nov 18, 2020 at 08:21 PM

I ended up using the Best HTTP/2 asset from the Asset store. This allowed use of SignalR in the way I wanted without any compatibility issues.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

320 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[C#] guitexture as button for player move on iOS/android 1 Answer

Is it possible to send SMS from an action in Unity? (Mobile iOS or Android) 1 Answer

Can Unity support Video Ads through ad providers like Greystripe, Admob, etc? 1 Answer

iOS / Android OnApplicationPause: incoming calls vs home button 1 Answer

Native list views on Mobile? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges