BuildFailedException: Burst Compiler (1.8.2) failed running | FileNotFound System.Diagnostics.Tracing

Unity 2021.3.16f1
Windows 10
Build Target: Android
Scripting Engine: IL2CPP

Trying to build for Meta Quest 2

URP 12.1.8 requires Burst 1.8.2

But for some reason, the build fails when trying to reference System.Diagnostics.Tracing
I looked on NuGet, and there doesn’t seem to be a 4.2.0.0 release of this package to begin with
I’m going to try to debug this, but i’m pretty stumped.
I’ve cleared my project-level package caches, my system-level package caches.
Restarted unity, my pc
I even tried making a fresh unity project and it runs into the same issues
about the only thing i haven’t done is a clean reinstall of unity.
If anyone is interested, I’ll post the minimum reproducible test case to github

Full Log Output:

BuildFailedException: Burst compiler (1.8.2) failed running
  
stdout:
Error: Failed to find entry-points:
System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.Tracing, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
   --- End of inner exception stack trace ---
   at System.Buffers.DefaultArrayPool`1.Rent(Int32 minimumLength)
   at Burst.Compiler.IL.Hashing.Storage.StringCollection.AddString(String value)
   at Burst.Compiler.IL.Hashing.CacheBuilder.ILHasher.ProcessAssemblyReference(AssemblyReferenceHandle assemblyReferenceHandle, StringCollection strings)
   at Burst.Compiler.IL.Hashing.CacheBuilder.ILHasher.ProcessAssemblyReferences(StringCollection strings)
   at Burst.Compiler.IL.Hashing.CacheBuilder.ILHasher.<>c__DisplayClass13_0.<HashImpl>b__3()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Burst.Compiler.IL.Hashing.CacheBuilder.ILHasher.HashImpl()
   at Burst.Compiler.IL.Hashing.CacheBuilder.ILHasher.HashAssembly(String filePath, TaskFactory taskFactory)
   at Burst.Compiler.IL.Hashing.CacheRuntime.HashCacheLoader.CreateHashingResult(AssemblyNameReference assemblyNameReference, AssemblyLoader assemblyLoader, DebugLogWriter debugLogWriter)
   at Burst.Compiler.IL.Hashing.CacheRuntime.HashCacheAssemblyStore.GetAssemblyState(String assemblyName, AssemblyLoader assemblyLoader)
   at Burst.Compiler.IL.Server.EntryPointMethodFinder.LoadAllAssemblyReferences(AssemblyDefinition asmDef, Dictionary`2 visited, Dictionary`2 jobProducers, HashCacheAssemblyStore assemblyStore, AssemblyLoader assemblyLoader)
   at Burst.Compiler.IL.Server.EntryPointMethodFinder.FindEntryPoints(String[] rootAssemblyNames, HashCacheAssemblyStore assemblyStore, AssemblyLoader assemblyLoader, NativeCompilerOptions options, ProfileDelegate profileCallback, Boolean includeRootAssemblyReferences, Boolean splitTargets, DebugLogWriter debugWriter)
   at Burst.Compiler.IL.Server.FindMethodsJob.Execute(CompilerServerJobExecutionContext context)
---> (Inner Exception #0) System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.Tracing, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Diagnostics.Tracing, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
  
=== Pre-bind state information ===
LOG: DisplayName = System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///K:/Code/RingPlanetOrbit/Library/PackageCache/com.unity.burst@1.8.2/.Runtime/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: K:\Code\RingPlanetOrbit\Library\PackageCache\com.unity.burst@1.8.2\.Runtime\bcl.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.0.0.0 redirected to 4.2.0.0.
LOG: Post-policy reference: System.Diagnostics.Tracing, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///K:/Code/RingPlanetOrbit/Library/PackageCache/com.unity.burst@1.8.2/.Runtime/System.Diagnostics.Tracing.DLL.
LOG: Attempting download of new URL file:///K:/Code/RingPlanetOrbit/Library/PackageCache/com.unity.burst@1.8.2/.Runtime/System.Diagnostics.Tracing/System.Diagnostics.Tracing.DLL.
LOG: Attempting download of new URL file:///K:/Code/RingPlanetOrbit/Library/PackageCache/com.unity.burst@1.8.2/.Runtime/System.Diagnostics.Tracing.EXE.
LOG: Attempting download of new URL file:///K:/Code/RingPlanetOrbit/Library/PackageCache/com.unity.burst@1.8.2/.Runtime/System.Diagnostics.Tracing/System.Diagnostics.Tracing.EXE.
  
   at System.Buffers.DefaultArrayPool`1.Rent(Int32 minimumLength)
   at Burst.Compiler.IL.Hashing.Storage.StringCollection.AddString(String value)
   at Burst.Compiler.IL.Hashing.CacheBuilder.ILHasher.ProcessAssemblyReference(AssemblyReferenceHandle assemblyReferenceHandle, StringCollection strings)
   at Burst.Compiler.IL.Hashing.CacheBuilder.ILHasher.ProcessAssemblyReferences(StringCollection strings)
   at Burst.Compiler.IL.Hashing.CacheBuilder.ILHasher.<>c__DisplayClass13_0.<HashImpl>b__3()
   at System.Threading.Tasks.Task.Execute()
  
<---
  
stderr:
  
Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at Library/PackageCache/com.unity.burst@1.8.2/Editor/BurstAotCompiler.cs:1728)
Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at Library/PackageCache/com.unity.burst@1.8.2/Editor/BurstAotCompiler.cs:1594)
Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunManagedProgram (System.String exe, System.String args, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at Library/PackageCache/com.unity.burst@1.8.2/Editor/BurstAotCompiler.cs:1569)
Unity.Burst.Editor.BurstAotCompiler.OnPostBuildPlayerScriptDLLsImpl (Unity.Burst.Editor.BurstAotCompiler+BurstAOTSettings settings, UnityEditor.Compilation.Assembly[] playerAssemblies) (at Library/PackageCache/com.unity.burst@1.8.2/Editor/BurstAotCompiler.cs:710)
Unity.Burst.Editor.BurstAOTCompilerPostprocessor.DoGenerate (UnityEditor.Compilation.Assembly[] assemblies) (at Library/PackageCache/com.unity.burst@1.8.2/Editor/BurstAotCompiler.cs:265)
Unity.Burst.Editor.BurstAOTCompilerPostprocessor.OnPostBuildPlayerScriptDLLs (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/com.unity.burst@1.8.2/Editor/BurstAotCompiler.cs:189)
UnityEditor.Build.BuildPipelineInterfaces.OnPostBuildPlayerScriptDLLs (UnityEditor.Build.Reporting.BuildReport report) (at <11d97693183d4a6bb35c29ae7882c66b>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

workaround:

Edit
K:\Code\RingPlanetOrbit\Library\PackageCache\com.unity.burst@1.8.2\.Runtime\bcl.exe.Config
and change System.Diagnostics.Tracing to 4.0.0.0 (instead of 4.2.0.0) and copy/paste the .dll file into the same folder from another project

Solution from here helped me:

https://forum.unity.com/threads/cant-build-on-windows-with-burst-1-8-3-unity-2022-2-6f1.1400761/

Thanks to all the people who have previously dedicated time and effort to find a solution.
In case it still happens to someone and has tried everything above without results.
I am on Unity version 2021.3.23f1 and I only got the error when using the IWorldAI library https://inworld.ai/.
When I looked at the logs in Jobs > Burst > Open Inspector I saw that I had an error in the Newtonsoft’s library.
I reinstalled it and it worked without problems.
Made With Unity | Newtonsoft’s Json.NET | by Rehtse Studio | Medium .

I hope I’ve helped.

Make sure you agreed to the latest agreements from Apple through Xcode. When you open Xcode it should ask you to accept new agreements and such.
That’s what did it for me.