CymaticLabs / Unity3D.Amqp

AMQP client library for Unity 3D supporting RabbitMQ
MIT License
97 stars 21 forks source link

L2CPP error for type 'System.Collections.Generic.SynchronizedCollection #13

Closed bwyyoung closed 4 years ago

bwyyoung commented 5 years ago

I got an il2cpp error below when compiling for iOS under Unity 2018.3.3f1: il2cpp.exe didn't catch exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

Failed running /Applications/Unity/Unity.app/Contents/il2cpp/build/il2cppcore/il2cppcore.dll --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --map-file-parser="/Applications/Unity/Unity.app/Contents/Tools/MapFileParser/MapFileParser" --directory="/Users/insas.unity/Desktop/final_internship_AR/unity_ARProject/sliding_puzzle_video_2018.3.3f1_mac/Temp/StagingArea/Data/Managed" --generatedcppdir="/Users/insas.unity/Desktop/final_internship_AR/unity_ARProject/sliding_puzzle_video_2018.3.3f1_mac/Temp/il2cppOutput/il2cppOutput" 

stdout:
IL2CPP error for type 'System.Collections.Generic.SynchronizedCollection`1' in assembly '/Users/insas.unity/Desktop/final_internship_AR/unity_ARProject/sliding_puzzle_video_2018.3.3f1_mac/Temp/StagingArea/Data/Managed/System.ServiceModel.dll'
Additional information: Build a development build for more information. The given key was not present in the dictionary.
il2cpp.exe didn't catch exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Unity.IL2CPP.Metadata.VTableBuilder.OverrideInterfaceMethods(Dictionary`2 interfaceOffsets, List`1 slots, Dictionary`2 overrides, Dictionary`2 overrideMap)
   at Unity.IL2CPP.Metadata.VTableBuilder.VTableForType(TypeDefinition typeDefinition, Dictionary`2 interfaceOffsets, Int32 currentSlot)
   at Unity.IL2CPP.Metadata.VTableBuilder.VTableFor(TypeReference typeReference, TypeResolver resolver)
   at Unity.IL2CPP.Metadata.MetadataCollector.AddVTables(IEnumerable`1 types)
   at Unity.IL2CPP.Metadata.MetadataCollector.AddAssemblies(ICollection`1 assemblies)
   at Unity.IL2CPP.AssemblyConverter.Apply()
   at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable`1 assemblyDirectories, IEnumerable`1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[] searchDirectories, String entryAssemblyName, NPath[] extraTypesFiles)
   at il2cpp.Program.DoRun(String[] args)
   at il2cpp.Program.Run(String[] args)
   at il2cpp.Program.Main(String[] args)
stderr:

Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Unity.IL2CPP.Metadata.VTableBuilder.OverrideInterfaceMethods(Dictionary`2 interfaceOffsets, List`1 slots, Dictionary`2 overrides, Dictionary`2 overrideMap)
   at Unity.IL2CPP.Metadata.VTableBuilder.VTableForType(TypeDefinition typeDefinition, Dictionary`2 interfaceOffsets, Int32 currentSlot)
   at Unity.IL2CPP.Metadata.VTableBuilder.VTableFor(TypeReference typeReference, TypeResolver resolver)
   at Unity.IL2CPP.Metadata.MetadataCollector.AddVTables(IEnumerable`1 types)
   at Unity.IL2CPP.Metadata.MetadataCollector.AddAssemblies(ICollection`1 assemblies)
   at Unity.IL2CPP.AssemblyConverter.Apply()
   at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable`1 assemblyDirectories, IEnumerable`1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[] searchDirectories, String entryAssemblyName, NPath[] extraTypesFiles)
   at il2cpp.Program.DoRun(String[] args)
   at il2cpp.Program.Run(String[] args)
   at il2cpp.Program.Main(String[] args)
   at Program.Main(String[] args)

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
UnityEditorInternal.Runner:RunNetCoreProgram(String, String, String, CompilerOutputParserBase, Action`1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:79)
UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:366)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:349)
UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:211)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:35)
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
bwyyoung commented 5 years ago

After I removed the CymanticLabs folder under assets, the project managed to build and run on iOS devices. It seems to be an issue with System.Collections being used in AMQP.

Can someone help?

auusi9 commented 4 years ago

Hi @bwyyoung, did you manage to solve the issue? Or did you find a workaround?

Thanks.

PePoDev commented 4 years ago

Same issue

bwyyoung commented 4 years ago

No I have not resolved this issue.

auusi9 commented 4 years ago

I recompiled the dotnet 4 version of RabbitMQ dll and Cymatic labs source code and now it works for me.

Give it a try.

RabbitMQ.zip

bwyyoung commented 4 years ago

Ok Thank you. I will try it later. Closing this issue now.

janosch09 commented 4 years ago

I recompiled the dotnet 4 version of RabbitMQ dll and Cymatic labs source code and now it works for me.

Give it a try.

RabbitMQ.zip

Can you tell me what exactly did you do? Your uploaded files work fine for me but if I try to compile it by myself I always get an error when building in Unity.

auusi9 commented 4 years ago

Sorry for the long delay. I forked the project and uploaded the code that I compiled to make it work. You can check it out here: https://github.com/auusi9/Unity3D.Amqp