Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug "Bee" Library build fail Windows.Foundation Android

Discussion in 'Editor & General Support' started by Sashell_, Sep 4, 2023.

  1. Sashell_

    Sashell_

    Joined:
    Jul 14, 2021
    Posts:
    8
    Hi,

    I recently tried to switch a MRTK HoloLens project to Android for a MagicLeap build, meaning switching build config from UWP to Android.

    Thing is, whenever I try to build, I get this error :

    Building Library\Bee\artifacts\Android\ManagedStripped failed with output:
    C:\Program Files\Unity\Hub\Editor\2022.3.7f1\Editor\Data\il2cpp\build\deploy\UnityLinker.exe @Library\Bee\artifacts\rsp\3806026182830091584.rsp
    Fatal error in Unity CIL Linker
    Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Windows.Foundation.UniversalApiContract, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null'
    at Unity.IL2CPP.Common.MissingMethodStubber.GetTypeModule(TypeReference type, IEnumerable`1 assemblies)
    at Unity.Linker.Steps.AddUnresolvedStubsStep.MarkAssemblyOfType(UnityLinkContext context, TypeReference type)
    at Unity.Linker.Steps.Marking.UnresolvedStubMarking.HandleUnresolvedType(TypeReference reference)
    at Unity.Linker.Steps.UnityMarkStep.HandleUnresolvedType(TypeReference reference)
    at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
    at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason)
    at Mono.Linker.Steps.MarkStep.MarkFields(TypeDefinition type, Boolean includeStatic, DependencyInfo& reason, Boolean markBackingFieldsOnlyIfPropertyMarked)
    at Mono.Linker.Steps.MarkStep.ApplyPreserveInfo(TypeDefinition type)
    at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
    at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
    at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason)
    at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet`1 typesAlreadyVisited)
    at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet`1 typesAlreadyVisited)
    at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
    at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
    at Unity.Linker.Steps.UnityMarkStep.InitializeAssembly(AssemblyDefinition assembly)
    at Mono.Linker.Steps.MarkStep.Initialize()
    at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context)
    at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
    at Mono.Linker.Pipeline.Process(LinkContext context)
    at Unity.Linker.UnityDriver.UnityRun(UnityLinkContext context, UnityPipeline p, LinkRequest linkerOptions, TinyProfiler2 tinyProfiler, ILogger customLogger)
    at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(TinyProfiler2 tinyProfiler, ILogger customLogger)
    at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling()
    at Unity.Linker.UnityDriver.RunDriver()

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    I know this means someting somewhere is referencing a WinRT or WinMD namespace, but everything in my code that does is conditionned by
    "#if WINDOWS_UWP ; #if ENABLE_WINMD_SUPPORT ; #if !UNITY_EDITOR && UNITY_WSA_10_0 ; #if NETFX_CORE ; #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN ; #if (UNITY_WSA && !UNITY_EDITOR)..."

    I tried to check into the .rsp file to see if Windows.Foundation is referenced but it isn't, and the only topic I can find on internet that is close is talking about the Burst package that fixed it above v1.7.x -> I have Burst (used by gltFast), but the 1.8.3 version that does not have the issue any more....

    Anyone came across this problem before ?

    Thanks
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,498
    Could it be any precompiled DLLs are referencing it?
     
  3. Sashell_

    Sashell_

    Joined:
    Jul 14, 2021
    Posts:
    8
    Hi,

    How can I check that ? This is a big project with many (really, many) dlls...
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,498
    You can use ILSpy to inspect precompiled DLLs.
     
  5. Sashell_

    Sashell_

    Joined:
    Jul 14, 2021
    Posts:
    8
    Thanks ! I'll try that and post any update.