You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Unity构建报错:Burst编译器缺失System.Diagnostics.Tracing程序集求助

Unity构建失败:System.Diagnostics.Tracing版本找不到问题

环境信息

  • Unity版本:2021.3.16f1
  • 操作系统:Windows 10
  • 构建目标:Android - Quest 2
  • 脚本引擎:IL2CPP
  • 渲染引擎:URP 12.1.8(依赖Burst 1.8.2)

问题描述

引用System.Diagnostics.Tracing时构建意外失败,NuGet上不存在4.2.0.0版本的该包。已尝试清理项目及系统级包缓存、重启Unity和电脑、新建空白项目,问题依旧,尚未尝试重装Unity。后续会上传最小复现案例到GitHub。

完整错误日志

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&)

解决方法

1. 调整Burst配置文件的版本重定向

找到Burst包目录下的bcl.exe.Config(路径示例:Library/PackageCache/com.unity.burst@1.8.2/.Runtime/bcl.exe.Config),打开后修改System.Diagnostics.Tracing的版本重定向规则,指向系统中实际存在的版本:

<!-- 修改前 -->
<dependentAssembly>
    <assemblyIdentity name="System.Diagnostics.Tracing" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>

<!-- 修改后(示例,根据实际存在的版本调整) -->
<dependentAssembly>
    <assemblyIdentity name="System.Diagnostics.Tracing" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
</dependentAssembly>

2. 手动添加兼容版本的DLL

从NuGet下载System.Diagnostics.Tracing的有效版本(如4.3.0),将对应的DLL文件复制到Burst的Runtime目录(com.unity.burst@1.8.2/.Runtime/),确保版本与配置文件中的重定向一致。

3. 升级Burst或Unity版本

URP 12.1.8依赖Burst 1.8.2,但该版本可能存在依赖兼容问题。尝试升级到Burst的更高兼容版本(需确认URP支持),或升级Unity到2021.3系列的更高补丁版本,这类版本通常会修复已知的依赖问题。

4. 临时禁用Burst编译

如果项目不需要Burst优化,可以在Player Settings中关闭Burst编译:

  • 进入Edit > Project Settings > Player > Other Settings
  • 找到Burst Compiler选项,取消勾选Enable Burst Compilation
  • 重新构建项目

内容的提问来源于stack exchange,提问作者jake downs

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 19:57:02