grpc / grpc

The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)

Home Page:https://grpc.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C# in Unity 2021: DllNotFoundException: grpc_csharp_ext

KinJin-Ristina opened this issue · comments

What version of gRPC and what language are you using?

Package Version
Grpc 2.47.0
Grpc.Core 2.47.0
Grpc.Core.Api 2.47.0
Grpc.Tools 2.47.0

Language : C#

What operating system (Linux, Windows,...) and version?

macOS 11.2.3 (M1), By the way,I didn't have this problem with mac(intel) and window, only with mac(M1)

What runtime / compiler are you using (e.g. python version or version of gcc)

Unity 2021.3.3f1c1(Silicon)

Unity Package : grpc_unity_package.2.47.0-dev202204160906.zip

What did you do?

Just init channel
image

What did you expect to see?

I tried to change the grpc_csharp_ext Platform settings,but it didn't work.
image

What did you see instead?

DllNotFoundException: grpc_csharp_ext assembly:<unknown assembly> type:<unknown type> member:(null)
Grpc.Core.Internal.NativeLogRedirector.Redirect (Grpc.Core.Internal.NativeMethods native) (at /var/local/git/grpc/src/csharp/Grpc.Core/Internal/NativeLogRedirector.cs:49)
Grpc.Core.Internal.NativeExtension..ctor () (at /var/local/git/grpc/src/csharp/Grpc.Core/Internal/NativeExtension.cs:46)
Grpc.Core.Internal.NativeExtension.Get () (at /var/local/git/grpc/src/csharp/Grpc.Core/Internal/NativeExtension.cs:67)
Grpc.Core.Internal.NativeMethods.Get () (at /var/local/git/grpc/src/csharp/Grpc.Core/Internal/NativeMethods.cs:49)
Grpc.Core.GrpcEnvironment.GrpcNativeInit () (at /var/local/git/grpc/src/csharp/Grpc.Core/GrpcEnvironment.cs:373)
Grpc.Core.GrpcEnvironment..ctor () (at /var/local/git/grpc/src/csharp/Grpc.Core/GrpcEnvironment.cs:302)
Grpc.Core.GrpcEnvironment.AddRef () (at /var/local/git/grpc/src/csharp/Grpc.Core/GrpcEnvironment.cs:78)
Grpc.Core.Channel..ctor (System.String target, Grpc.Core.ChannelCredentials credentials, System.Collections.Generic.IEnumerable`1[T] options) (at /var/local/git/grpc/src/csharp/Grpc.Core/Channel.cs:70)
Grpc.Core.Channel..ctor (System.String target, Grpc.Core.ChannelCredentials credentials) (at /var/local/git/grpc/src/csharp/Grpc.Core/Channel.cs:55)
Inspir.AINet.Init (System.String ip) (at Assets/Scripts/freecity/AISystem/AINet.cs:24)
Inspir.AISystem.Init (System.String aiServer) (at Assets/Scripts/freecity/AISystem/AISystem.cs:21)
AppStart.ClickEnterBtn () (at Assets/Scripts/freecity/Logic/AppStart.cs:79)
UnityEngine.Events.InvokableCall.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/UnityEvent/UnityEvent.cs:178)
UnityEngine.Events.UnityEvent.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/UnityEvent/UnityEvent/UnityEvent_0.cs:58)
UnityEngine.UI.Button.Press () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:70)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:114)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:57)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)

Anything else we should know about your project / environment?

C#: grpc_csharp_ext.dll not found when running under xunit #12154
Grpc.Core.Xamarin System.DllNotFoundException: grpc_csharp_ext assembly: type: member:(null) #28218
C#: DllNotFoundException: grpc_csharp_ext when running under Ubuntu / Unity (when NuGetForUnity is used)

Any help would be greatly appreciated,Best wish!!

I think the general problem is that the Mac M1 version of the grpc_csharp_ext native library isn't available (we only ship the native library for Intel Mac)

With that, I'm going to close issue this since we're not going to pursue Unity/Xamarin support in Grpc.Core anymore.

  • The Grpc.Core implementation is now in maintenance mode and we're only going to focus on critical and security fixes.
  • Supporting Unity/Xamarin simply presents too much maintenance overhead and it's also difficult to test with the test infrastructure available to us
  • The Unity/Xamarin support has always been classified as "experimental", so discontinuing the support shouldn't be too surprising.

See the recent update on gRPC C# for more details.