Linking fails for Unity Xbox One builds

Issue #308 resolved
Ababei Dragos
created an issue

Hi,

I'm trying to build a project for XboxOne with a IL2CPP and .NET 4.6 configuration. I use Odin Inspector & Serializer version 1.0.5.3

Linking failes with the following error:

**Failed running C:\Program Files\Unity2017.3.1p1\Editor\Data\il2cpp/build/UnityLinker.exe 
   --api=NET_4_6 -out="D:\Test_project\Temp\StagingArea\Data\Managed\tempStrip" 
   -l=none 
   -c=link 
   --link-symbols 
   -x="C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Core.xml" 
   -f="C:\Program Files\Unity2017.3.1p1\Editor\Data\il2cpp\LinkerDescriptors" 
   -x "D:\Test_project\Temp\StagingArea\Data\Managed\..\platform_native_link.xml" 
   -x "D:\Test_project\Temp\StagingArea\Data/methods_pointedto_by_uievents.xml" 
   -x "D:\Test_project\Temp\StagingArea\Data/UnityEngine.xml" 
   -x "D:\Test_project\Temp\StagingArea\Data\preserved_derived_types.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\il2cpp\LinkerDescriptors\mscorlib45.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\il2cpp\LinkerDescriptors\System45.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Accessibility.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\AI.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Animation.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\AR.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\AssetBundle.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Audio.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Cloth.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Core.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\CrashReporting.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Director.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\GameCenter.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Grid.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\ImageConversion.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\IMGUI.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Input.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\JSONSerialize.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\ParticlesLegacy.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\ParticleSystem.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\PerformanceReporting.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Physics.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Physics2D.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\ScreenCapture.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\SharedInternals.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\SpriteMask.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\SpriteShape.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\StyleSheets.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Terrain.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\TerrainPhysics.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\TextRendering.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Tilemap.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UI.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UIElements.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UNET.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UnityAnalytics.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UnityConnect.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UnityWebRequest.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UnityWebRequestAudio.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UnityWebRequestTexture.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\UnityWebRequestWWW.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Vehicles.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Video.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\VR.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Web.xml" 
   -x "C:\Program Files\Unity2017.3.1p1\Editor\Data\PlaybackEngines\XboxOnePlayer\Whitelists\Wind.xml" 
   -x "D:\Test_project\Assets\Plugins\Sirenix\Assemblies\link.xml" 
   -x "D:\Test_project\Assets\Plugins\Sirenix\Assemblies\AOT\link.xml" 
   -x "D:\Test_project\Assets\_Third Party\HighlightingSystem\link.xml" 
   -d "D:\Test_project\Temp\StagingArea\Data\Managed" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\Assembly-CSharp-firstpass.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\UnityEngine.UI.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\Sirenix.Serialization.Config.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\Rewired_Core.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\I18N.CJK.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\I18N.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\I18N.MidEast.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\I18N.Other.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\I18N.Rare.dll" 
   -a  "D:\Test_project\Temp\StagingArea\Data\Managed\I18N.West.dll"

stdout:
Fatal error in Unity CIL Linker
Mono.Linker.MarkException: Error processing method: 'Sirenix.Serialization.ErrorHandlingPolicy Sirenix.Serialization.DebugContext::get_ErrorHandlingPolicy()' in assembly: 'Sirenix.Serialization.dll' ---> System.ArgumentNullException: Value cannot be null.
Parameter name: instruction
   at Mono.Cecil.Cil.InstructionOffset..ctor(Instruction instruction)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadScopes(Collection`1 scopes)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadScopes(Collection`1 scopes)
   at Mono.Cecil.Cil.CodeReader.ReadScope(ScopeDebugInformation scope)
   at Mono.Cecil.Cil.CodeReader.ReadDebugInfo()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Mono.Cecil.MethodDefinition.get_Body()
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at UnityLinker.Steps.UnityMarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.ProcessEntireQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at UnityLinker.Steps.UnityMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at UnityLinker.UnityDriver.Run()
   at UnityLinker.UnityDriver.RunDriver()
stderr:

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
UnityEditorInternal.AssemblyStripper:RunAssemblyLinker(IEnumerable`1, String&, String&, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:89)
UnityEditorInternal.AssemblyStripper:StripAssembliesTo(String[], String[], String, String, String&, String&, String, IIl2CppPlatformProvider, IEnumerable`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:82)
UnityEditorInternal.AssemblyStripper:RunAssemblyStripper(String, IEnumerable, String, String[], String[], String, IIl2CppPlatformProvider, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:204)
UnityEditorInternal.AssemblyStripper:StripAssemblies(String, IIl2CppPlatformProvider, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:114)
UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:152)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:34)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
CustomBuild:Build(BuildTargetGroup, BuildTarget) (at Assets/Scripts/Beam Team/Editor/CustomBuild.cs:115)
CustomBuild:BuildXB1() (at Assets/Scripts/Beam Team/Editor/CustomBuild.cs:165)**

I want to know if this is fixed in a newer version, a known issue or if you have any hints for me.

Thank you, Dragos<

Comments (25)

  1. Ababei Dragos reporter

    No, I don't use it in Editor only mode. I tried that, removed any script references to Odin serialization classes and the build compiled successfully, but then I got a lot of serialization errors at runtime.

    Edit: That file is located here: Assets\Plugins\Sirenix\Odin Inspector\Config\Resources\Sirenix\GlobalSerializationConfig.asset and no demos are included.

  2. Bjarke Elias

    Thanks, What are your import settings for the various DLL files for the target platform?

    Here is what I would expect when compiling with IL2CPP:

    /Assemblies/NoEditor/Sirenix.Serialization.dll              -> Not included
    /Assemblies/NoEditor/Sirenix.Utilities.dll                  -> Not included
    /Assemblies/NoEmitAndNoEditor/Sirenix.Serialization.dll     -> Included
    /Assemblies/NoEmitAndNoEditor/Sirenix.Utilities.dll         -> Included
    /Assemblies/Sirenix.Serialization.Config.dll                -> Included
    /Assemblies/Sirenix.OdinInspector.Attributes.dll            -> Included
    /Assemblies/*everything else here*                          -> Excluded (Editor Only)
    
  3. Bjarke Elias

    I'm installing UWP SDK and trying to make a build for that as that is the closest I can, and I've also found related errors on google where UWP was the target platform, so we'll see. Fingers crossed that I reproduce it :)

  4. Bjarke Elias

    Dran, Build succeeded with UWP + IL2CPP on my end. Going to investigate what it takes to build to XBoxOne.

    In the meantime, consider trying updating Odin. Just remember to do a backup if you decide to give it a go :)

  5. Ababei Dragos reporter

    So...

    I updated to the latest version (1.0.6.2) and the XboxOne build still fails, with another error:

    UnityException: Failed to run reference rewriter with command --target="Temp/StagingArea/Data/Managed\Sirenix.OdinInspector.Attributes.dll" --additionalreferences="D:\StrandedDeep_stable\Temp\StagingArea\Data\Man...
    Catastrophic failure while running rrw: System.InvalidOperationException: Operation is not valid due to the current state of the object.
       at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader) in C:\buildslave\cecil\build\Mono.Cecil\ModuleDefinition.cs:line 1066
       at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters) in C:\buildslave\cecil\build\Mono.Cecil\AssemblyReader.cs:line 108
       at Mono.Cecil.ModuleReader.CreateModule(Image image, ReaderParameters parameters) in C:\buildslave\cecil\build\Mono.Cecil\AssemblyReader.cs:line 85
       at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters) in C:\buildslave\cecil\build\Mono.Cecil\ModuleDefinition.cs:line 1097
       at Unity.ReferenceRewriter.RewriteContext.For(String targetModule, DebugSymbolFormat symbolFormat, String supportModule, String supportModulePartialNamespace, String[] frameworkPaths, String projectLockFile, String[] additionalReferences, String platformPath, ICollection`1 strongNamedReferences, ICollection`1 winmdReferences, IDictionary`2 alt, IDictionary`2 ignore)
       at Unity.ReferenceRewriter.Program.Main(String[] args)
    Catastrophic failure while running rrw: System.InvalidOperationException: Operation is not valid due to the current state of the object.
       at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader) in C:\buildslave\cecil\build\Mono.Cecil\ModuleDefinition.cs:line 1066
       at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters) in C:\buildslave\cecil\build\Mono.Cecil\AssemblyReader.cs:line 108
       at Mono.Cecil.ModuleReader.CreateModule(Image image, ReaderParameters parameters) in C:\buildslave\cecil\build\Mono.Cecil\AssemblyReader.cs:line 85
       at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters) in C:\buildslave\cecil\build\Mono.Cecil\ModuleDefinition.cs:line 1097
       at Unity.ReferenceRewriter.RewriteContext.For(String targetModule, DebugSymbolFormat symbolFormat, String supportModule, String supportModulePartialNamespace, String[] frameworkPaths, String projectLockFile, String[] additionalReferences, String platformPath, ICollection`1 strongNamedReferences, ICollection`1 winmdReferences, IDictionary`2 alt, IDictionary`2 ignore)
       at Unity.ReferenceRewriter.Program.Main(String[] args)
    
    UnityEditor.PostProcessXboxOnePlayer.RunReferenceRewriter (System.String playerPackage, System.String stagingAreaDataManaged, System.String[] references) (at C:/buildslave/unity/build/PlatformDependent/XboxOne/Editor/Managed/PostProcessXboxOnePlayer.cs:1155)
    UnityEditor.PostProcessXboxOnePlayer.PostProcess (UnityEditor.BuildTarget target, UnityEditor.BuildOptions options, System.String installPath, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String stagingAreaDataManaged) (at C:/buildslave/unity/build/PlatformDependent/XboxOne/Editor/Managed/PostProcessXboxOnePlayer.cs:444)
    UnityEditor.XboxOne.XboxOneBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/XboxOne/Editor/Managed/ExtensionModule.cs:85)
    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.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:272)
    UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
    CustomBuild:Build(BuildTargetGroup, BuildTarget) (at Assets/Scripts/Beam Team/Editor/CustomBuild.cs:115)
    CustomBuild:BuildXB1() (at Assets/Scripts/Beam Team/Editor/CustomBuild.cs:165)
    
  6. Bjarke Elias

    1.0.6.3 should be the latest btw. Hmm if it has trouble reading debug symbols, try removing the pdb/mdb files for each dll assembly.

    Have you tried this approach btw? https://docs.microsoft.com/en-us/windows/uwp/xbox-apps/development-lanes-unity Where you build UWP with IL2CPP and then deploying that to Xbox one?

    Also, do you know if there is a way I can reproduce your error without owning an XBox One? Do I require an account and everything to get the XBox One module? https://jumpshare.com/v/88ddYgtyWSDVBefPK91c

  7. Ababei Dragos reporter

    Yeah, deleting the pdb/mdb files did the trick. The XboxOne build is up and running now.

    Thank you very much for your assistance and keep up the good work.

    Dragos

  8. Bjarke Elias

    Great! So the issue is not something we can do much about on our end, besides removing the mdb and pdb files completely, which we could consider. But good to know it's easily fixable at least.

    We're working on a new web-site, and I think this bug would fit nicely into a "known issues" page.

  9. Log in to comment