Build Failed Library/Bee/artifacts/iOS/ManagedStripped

Hey guys, getting an error message to build the project after clicking “Reimport All” for some reason. I’m using unity version 2022.3.20f1, polyspatial 1.0.3 and XR Plugin for vision 1.0.3.

The error starts like this:
Building Library/Bee/artifacts/iOS/ManagedStripped failed with output: /Applications/Unity/Hub/Editor/2022.3.20f1/Unity.app/Contents/il2cpp/build/deploy/UnityLinker --allowed-assembly=/Applications/Unity/Hub/Editor/2022.3.20f1/PlaybackEngines/VisionOSPlayer/Variations/il2cpp/Managed/UnityEngine.AIModule.dll --allowed-assembly=/Applications/Unity/Hub/Editor/2022.3.20f1/PlaybackEngines/VisionOSPlayer/Variations/il2cpp/Managed/UnityEngine.ARModule.dll

And then there’s just a massive string that says the output was truncated. The project was building before…

I tried “Reimport All”, deleting the library folder, reimporting polyspatial and changing the Unity version.

2 Likes

I am getting the same. I just posted as well, should I delete my post? First time posting on unity forums.

1 Like

Have you tried closing Unity, deleting Library/bee, then reopening and building again?

1 Like

I’ve tried that, and I still get the same thing.

Yeah I tried that, didn’t work. I’m honestly lost here

I get the same error when trying to build.

I’m building for visionOS, too, but using 2022.3.19f1. No PolySpatial since “App Mode = fully immersive”.

1 Like

Looking at the full output in Editor.log was interesting. There I can read that the error is caused by

Failed to resolve assembly: ‘WindowsBase, …’

Fatal error in Unity CIL Linker
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'
   at Unity.IL2CPP.Common.MissingMethodStubber.GetTypeModule(TypeReference type, IEnumerable`1 assemblies) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Common/MissingMethodStubber.cs:line 178
   at Unity.Linker.Steps.AddUnresolvedStubsStep.MarkAssemblyOfType(UnityLinkContext context, TypeReference type) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/AddUnresolvedStubsStep.cs:line 18
   at Unity.Linker.Steps.Marking.UnresolvedStubMarking.HandleUnresolvedType(TypeReference reference) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/Marking/UnresolvedStubMarking.cs:line 96
   at Unity.Linker.Steps.UnityMarkStep.HandleUnresolvedType(TypeReference reference) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 207
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1406
   at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1293
   at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet`1 typesAlreadyVisited) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 315
   at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1159
   at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 204
   at Unity.Linker.Steps.UnityMarkStep.InitializeAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 34
   at Mono.Linker.Steps.MarkStep.Initialize() in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 194
   at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 255
   at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityPipeline.cs:line 22
   at Mono.Linker.Pipeline.Process(LinkContext context) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker/Pipeline.cs:line 128
   at Unity.Linker.UnityDriver.UnityRun(UnityLinkContext context, UnityPipeline p, LinkRequest linkerOptions, TinyProfiler2 tinyProfiler, ILogger customLogger) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 160
   at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(TinyProfiler2 tinyProfiler, ILogger customLogger) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 100
   at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling() in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 68
   at Unity.Linker.UnityDriver.RunDriver() in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 49

I still don’t know how to solve this. But maybe you @guubebra and @flashno can check your Editor.log files and see if it the same error in your cases. - And hopefully this helps finding a solution for us. :slight_smile:

My “solution” was unfortunately creating a project from scratch and importing all my project files as a unity package, this worked. I still don’t know why the error occured even if I deleted my whole Library folder. Sorry not being able to help too much.

I figured out how to fix this. Just go to your log file and you should see some library that’s causing the issues. Mine was a deeplinking library that I had to delete from Assets>plugins. Log is located on mac in Library > Logs > Unity >Editor.log. Hope this helps!

1 Like

I found another solution! :tada:

Unity can successfully build after I set the Managed Stripping Level to Medium or High.

Go to Project Settings > Player under Optimization you can find the Managed Stripping Level. The default value is Minimal.

I guess, that the higher the level is set, the closer the linker (?) checks whether or not some code is actually used for the current build. Minimal or Low are not enough. Only with Medium or High the linker (?) realizes that we don’t need WindowsBase.dll for our visionOS build. :slight_smile:

3 Likes

In my case, it was happening because one of my Runtime AssemblyDefinitions for Unit Tests was missing the UNITY_INCLUDE_TESTS in the DefineConstraints causing the nunit.framework reference to get built and trigger build errors.

1 Like

For me, I was able to fix the issue by removing an using NUnit namespace from my project, and replacing my asserts with the ones from UnityEngine.Assertions. I definitely should look into Unity’s testing framework, but this was a quick fix for me.

(P.S. I found the problem by going to %LOCALAPPDATA%/Unity/Editor and opening the Editor text file with IntelliJ for color highlighting. It’s a pretty intimidating 20k line file, but it told me fairly exactly what was causing the error)

Fatal error in Unity CIL Linker

Mono.Linker.LinkerFatalErrorException: C:\Users\amaze\OneDrive\Desktop\Folders\Important\GitHub\GMTK\GMTK-Spark\GMTK-Spark\Assets\Paper\Scripts\AssertOriginPosition.cs(10,9): error IL1005: .AssertOriginPosition.Start(): Error processing method '.AssertOriginPosition.Start()' in assembly 'Assembly-CSharp.dll'

 ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=null'
3 Likes

This helped, thanks.

1 Like

I found another solution.
If your project folder name contains commas(,), dots(.), or any other special characters, the build may fail.
Fix: Simply remove the special characters (like , or .) from the project folder name.

NUnit was also my issue thank you

1 Like