2017-10-16 145 views
0

我正在嘗試使gRPC與Xamarin一起工作。Xamarin,Grpc,無法使用標記解析類型0100002b

我知道你可能會認爲這是重複的問題,原因有計算器上有關該錯誤類似的問題,但我已經嘗試了鞏固所有引用和的NuGet包,試圖清潔工程和重建。

我已經嘗試過Xamarin.Forms,Windows 7和Windows 10上的Xamarin Android項目。它們都有相同的錯誤。獲得一致的例外:

Channel channel = new Channel(ip, port, ChannelCredentials.Insecure); 

例外:

"Could not resolve type with token 0100002b (from typeref, class/assembly System.Runtime.Loader.AssemblyLoadContext, System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)" 

輸出:

10-16 10:19:28.057 D/Mono(13519): Assembly Ref addref Grpc.Core[0x7f9e5ad500] -> System.Core[0x7f89b19500]: 4 
10-16 10:19:28.062 D/Mono (13519): Image addref System[0x7f89750280] -> System.dll[0x7f89a5e000]: 2 
10-16 10:19:28.062 D/Mono(13519): Prepared to set up assembly 'System' (System.dll) 
10-16 10:19:28.062 D/Mono(13519): Assembly System[0x7f89750280] added to domain RootDomain, ref_count = 1 
10-16 10:19:28.076 D/Mono(13519): AOT: image 'System.dll.so' not found: dlopen failed: library "/data/app/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp-1/lib/arm64/libaot-System.dll.so" not found 
10-16 10:19:28.084 D/Mono(13519): AOT: image '/usr/local/lib/mono/aot-cache/arm64/System.dll.so' not found: dlopen failed: library "/data/app/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp-1/lib/arm64/libaot-System.dll.so" not found 
10-16 10:19:28.084 D/Mono(13519): Config attempting to parse: 'System.dll.config'. 
10-16 10:19:28.084 D/Mono(13519): Config attempting to parse: '/usr/local/etc/mono/assemblies/System/System.config'. 
10-16 10:19:28.084 D/Mono(13519): Assembly Ref addref System.Core[0x7f89b19500] -> System[0x7f89750280]: 2 
10-16 10:19:28.085 D/Mono (13519): Assembly Ref addref System[0x7f89750280] -> mscorlib[0x7fb0aa3e00]: 16 
Loaded assembly: System.dll[External] 
10-16 10:19:28.134 D/Mono(13519): Assembly Loader probing location: '/storage/emulated/0/Android/data/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp/files/.__override__/System.Runtime.Loader.dll'. 
10-16 10:19:28.134 D/Mono(13519): Image addref System.Runtime.Loader[0x7f89750380] -> /storage/emulated/0/Android/data/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp/files/.__override__/System.Runtime.Loader.dll[0x7f8975e800]: 2 
10-16 10:19:28.135 D/Mono(13519): Prepared to set up assembly 'System.Runtime.Loader' (/storage/emulated/0/Android/data/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp/files/.__override__/System.Runtime.Loader.dll) 
10-16 10:19:28.135 D/Mono(13519): Assembly System.Runtime.Loader[0x7f89750380] added to domain RootDomain, ref_count= 1 
10-16 10:19:28.138 D/Mono (13519): AOT: image '/storage/emulated/0/Android/data/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp/files/.__override__/System.Runtime.Loader.dll.so' not found: dlopen failed: library "/data/app/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp-1/lib/arm64/libaot-System.Runtime.Loader.dll.so" not found 
10-16 10:19:28.143 D/Mono(13519): AOT: image '/usr/local/lib/mono/aot-cache/arm64/System.Runtime.Loader.dll.so' not found: dlopen failed: library "/data/app/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp-1/lib/arm64/libaot-System.Runtime.Loader.dll.so" not found 
10-16 10:19:28.143 D/Mono(13519): Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp/files/.__override__/System.Runtime.Loader.dll'. 
10-16 10:19:28.143 D/Mono(13519): Config attempting to parse: '/storage/emulated/0/Android/data/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp/files/.__override__/System.Runtime.Loader.dll.config'. 
10-16 10:19:28.143 D/Mono(13519): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Runtime.Loader/System.Runtime.Loader.config'. 
10-16 10:19:28.143 D/Mono(13519): Assembly Ref addref Grpc.Core[0x7f9e5ad500] -> System.Runtime.Loader[0x7f89750380]: 2 
10-16 10:19:28.144 W/Mono (13519): The request to load the assembly mscorlib v4.0.0.0 was remapped to v2.0.5.0 
10-16 10:19:28.144 D/Mono(13519): Assembly Ref addref System.Runtime.Loader[0x7f89750380] -> mscorlib[0x7fb0aa3e00]: 17 
Loaded assembly: /storage/emulated/0/Android/data/GarmentInventoryAndroidApp.GarmentInventoryAndroidApp/files/.__override__/System.Runtime.Loader.dll[External] 

希望有人能幫助我。提前致謝!

+0

請注意,gRPC C#目前沒有官方支持Xamarin(我們正在使用本地C庫和核心RPC功能並通過P/Invoke調用它 - 我認爲這可能是導致您可能會看到的問題。可以使gRPC C#爲Xamarin工作,但它需要構建正在手動構建的grpc_csharp_ext.dll本地庫的正確版本(可能還有一些調整)。 –

+0

@janTattermusch謝謝你的回答。 –

回答

0

感謝@JanTattermusch答案:

請注意,GRPC C#目前沒有官方支持 爲Xamarin(我們使用的是原生的C庫和核心RPC 功能,並調用它通過P/Invoke - 我認爲這可能是 問題的根源,您可能會看到gRPC C#可以讓 爲Xamarin工作,但它需要構建正確版本的 grpc_csharp_ext.dll本地庫正在手動構建(並且可能還有一些調整 )。