microsoft / xbox-live-unity-plugin

The Xbox Live Unity Plugin provides a way for developers in the Xbox Live Creators Program to quickly and easily integrate Xbox Live functionality into their Unity based game. For ID@Xbox developers, this Xbox Live Unity Plugin does not yet support all the features you will need. Instead, contact your Microsoft representative.
MIT License
167 stars 62 forks source link

Fails To Compile With IL2CPP Backend #298

Closed RichmarIII closed 4 years ago

RichmarIII commented 4 years ago

Failed running H:\Unity\Hub\2019.3.11f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --incremental-g-c-time-slice=3 --profiler-report --map-file-parser=H:/Unity/Hub/2019.3.11f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe --directory="C:/Dev/Repositories/HawkEyeGames/New Unity Project/Temp/StagingArea/Data/Managed" --generatedcppdir="C:/Dev/Repositories/HawkEyeGames/New Unity Project/Temp/StagingArea/Il2CppOutputProject/Source/il2cppOutput"

stdout: IL2CPP error (no further information about what managed code was being converted is available) Additional information: Value cannot be null. Parameter name: method il2cpp.exe didn't catch exception: System.ArgumentNullException: Value cannot be null. Parameter name: method at Mono.Cecil.Cil.Instruction.Create(OpCode opcode, MethodReference method) at Unity.IL2CPP.Marshaling.BodyWriters.ManagedToNative.WindowsRuntimeProjection.IListProjectedMethodBodyWriter.WriteCallVectorMethodWithIndexCheckAndExceptionTranslation(MethodDefinition currentMethod, ParameterDefinition indexParameter, MethodDefinition vectorMethod) at Unity.IL2CPP.WindowsRuntime.InterfaceNativeToManagedAdapterGenerator.CreateAdapterClass(TypeDefinition clrInterface, TypeDefinition windowsRuntimeInterface, Dictionary2 adapterMethodBodyWriters) at Unity.IL2CPP.WindowsRuntime.InterfaceNativeToManagedAdapterGenerator.Generate(IEnumerable1 clrToWindowsRuntimeProjections, Dictionary2 adapterMethodBodyWriters) at Unity.IL2CPP.WindowsRuntimeProjectionsComponent.Initialize(ModuleDefinition mscorlib, RuntimeProfile dotNetProfile) at Unity.IL2CPP.AssemblyConverter.RegisterCorlib(AssemblyDefinition mscorlib) at Unity.IL2CPP.AssemblyConverter.Apply() at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable1 assemblyDirectories, IEnumerable1 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, List1 foundAssemblies) at il2cpp.Program.Run(String[] args, Boolean setInvariantCulture) at il2cpp.Program.Main(String[] args) stderr:

Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: method at Mono.Cecil.Cil.Instruction.Create(OpCode opcode, MethodReference method) at Unity.IL2CPP.Marshaling.BodyWriters.ManagedToNative.WindowsRuntimeProjection.IListProjectedMethodBodyWriter.WriteCallVectorMethodWithIndexCheckAndExceptionTranslation(MethodDefinition currentMethod, ParameterDefinition indexParameter, MethodDefinition vectorMethod) at Unity.IL2CPP.WindowsRuntime.InterfaceNativeToManagedAdapterGenerator.CreateAdapterClass(TypeDefinition clrInterface, TypeDefinition windowsRuntimeInterface, Dictionary2 adapterMethodBodyWriters) at Unity.IL2CPP.WindowsRuntime.InterfaceNativeToManagedAdapterGenerator.Generate(IEnumerable1 clrToWindowsRuntimeProjections, Dictionary2 adapterMethodBodyWriters) at Unity.IL2CPP.WindowsRuntimeProjectionsComponent.Initialize(ModuleDefinition mscorlib, RuntimeProfile dotNetProfile) at Unity.IL2CPP.AssemblyConverter.RegisterCorlib(AssemblyDefinition mscorlib) at Unity.IL2CPP.AssemblyConverter.Apply() at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable1 assemblyDirectories, IEnumerable1 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, List1 foundAssemblies) at il2cpp.Program.Run(String[] args, Boolean setInvariantCulture) at il2cpp.Program.Main(String[] args)

UnityEngine.Debug:LogError(Object) UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action1) UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List1, Action1, String) UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(Il2CppBuildPipelineData, String, String, Boolean) UnityEditorInternal.IL2CPPBuilder:Run() UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry) PostProcessWinRT:RunIL2CPPForProjectBuild() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:1874) PostProcessWinRT:RunIL2CPP() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:1845) PostProcessWinRT:Process() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:214) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

RichmarIII commented 4 years ago

Exception: H:\Unity\Hub\2019.3.11f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe did not run properly! UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo, System.String workingDirectory) (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <90d4bcb003fb405fb09241aed2f178aa>:0) PostProcessWinRT.RunIL2CPPForProjectBuild () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:1874) PostProcessWinRT.RunIL2CPP () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:1845) PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:214) UnityEditor.UWP.BuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:85) Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown. UnityEditor.UWP.BuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:89) UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <90d4bcb003fb405fb09241aed2f178aa>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

RichmarIII commented 4 years ago

IL2CPP error (no further information about what managed code was being converted is available) Additional information: Value cannot be null.

RichmarIII commented 4 years ago

After a very long trial and error (and a whim really) I was able to compile unity using the raw xbox-live-api successfully. This was solved by upgrading to the new unity build system. The package name is Scriptable Build Pipeline and it can be downloaded from the Unity Package Manager. Once it was installed, it simply compiled and worked. It should be known that the plugin still cannot be compiled as-is due to it not being updated to the new Unity API in 2018/2019+ such as UnityEngine.UI namespace being completely removed. I am using the raw xbox-live-api compiled with C++/WinRT. It compiles to a DLL named Microsoft.Xbox.Services.dll and cooresponding .WinMD file. Microsoft.Xbox.Services.dll, Microsoft.Xbox.Services.WinMD, and cpprest140_uwp_2_9.dll need to be added to the Unity Asset Folder and all should work well. Again, the plugin will not compile in 2018/2019+ due to Unity API changes, but the raw xbox-live-api will properly compile using the steps above.