When trying to create a development build (the normal build works) then the Burst Compiler will throw exceptions because I am calling the generic default interface function - start.DefaultEquals(goal).
I believe this to be a bug, since building the project normally works and there are no errors when saving the script. It only doesn’t work when trying to create a development build.
Unity 2022.3.18f1
Burst 1.8.15
Entities 1.2.0
How to replicate?
- Setup a fresh project with Entities & Burst
- Copy paste the Code
- Try to create a development build
namespace MyNamespace
{
public partial struct TestSystem : ISystem
{
public void OnCreate(ref SystemState state) { }
public void OnDestroy(ref SystemState state) { }
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var graph = new MyGenericGraph<MyGridCell>();
var cell1 = new MyGridCell(0);
var cell2 = new MyGridCell(1);
graph.DoSomething(cell1, cell2);
}
}
public struct MyGenericGraph<TNode> where TNode : unmanaged, IUniqueID
{
public bool DoSomething(TNode start, TNode goal)
{
return start.DefaultEquals(goal); // <---- This call does not let me build
//return start.UniqueID == goal.UniqueID; // <---- If I uncomment this line and comment the line above it works
}
}
public interface IUniqueID
{
public uint UniqueID { get; }
// Can't build, because of this function
public bool DefaultEquals<T>(T other) where T : unmanaged, IUniqueID
{
return other.UniqueID == UniqueID;
}
}
public struct MyGridCell : IUniqueID
{
private uint ID;
public uint UniqueID => ID;
public MyGridCell(uint id) { ID = id; }
}
}
Errors:
Error 1
Library\Bee\artifacts\WinPlayerBuildProgram\AsyncPluginsFromLinker: Burst internal compiler error: Burst.Compiler.IL.CompilerException: Error while verifying module: Basic Block in function ‘MyNamespace.MyGridCell, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.DefaultEquals(MyNamespace.MyGridCell*, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null this, MyNamespace.MyGridCell, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null other) → System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089_e8c422c1c2c293ebe557bf3517e8a7fc from Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have terminator!
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Error 2
Library\Bee\artifacts\WinPlayerBuildProgram\AsyncPluginsFromLinker: Burst internal compiler error: Burst.Compiler.IL.CompilerException: Error while verifying module: Basic Block in function ‘MyNamespace.MyGridCell, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.DefaultEquals(MyNamespace.MyGridCell*, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null this, MyNamespace.MyGridCell, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null other) → System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089_4837f07d292883d96fd4484c39b80b2b from Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have terminator!
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Error3
Building Library\Bee\artifacts\WinPlayerBuildProgram\AsyncPluginsFromLinker failed with output:
UnityEditor.Build.BuildFailedException: Burst compiler (1.8.15) failed running
stdout:
Starting 1 library requests
Error: Burst internal compiler error: Burst.Compiler.IL.CompilerException: Error while verifying module: Basic Block in function ‘MyNamespace.MyGridCell, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.DefaultEquals(MyNamespace.MyGridCell*, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null this, MyNamespace.MyGridCell, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null other) → System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089_e8c422c1c2c293ebe557bf3517e8a7fc from Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have terminator!
label %BL.0019
at Burst.Compiler.IL.NativeCompiler.Compile(CompilerStatistics stats)
at Burst.Compiler.IL.Server.LibraryCompiler.HashAndCompileMethodGroup(CompilationJob request, Int32 methodGroupIndex, SharedLibraryCompilationState sharedState, AotCompilerOptions defaultOptions, NativeCompiler& nativeCompiler, AotModuleGroup& aotModuleGroup)
Error: Burst internal compiler error: Burst.Compiler.IL.CompilerException: Error while verifying module: Basic Block in function ‘MyNamespace.MyGridCell, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.DefaultEquals(MyNamespace.MyGridCell*, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null this, MyNamespace.MyGridCell, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null other) → System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089_4837f07d292883d96fd4484c39b80b2b from Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have terminator!
label %BL.0019
at Burst.Compiler.IL.NativeCompiler.Compile(CompilerStatistics stats)
at Burst.Compiler.IL.Server.LibraryCompiler.HashAndCompileMethodGroup(CompilationJob request, Int32 methodGroupIndex, SharedLibraryCompilationState sharedState, AotCompilerOptions defaultOptions, NativeCompiler& nativeCompiler, AotModuleGroup& aotModuleGroup)
stderr:
at Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Boolean unreliableExitCode) [0x00224] in .\Library\PackageCache\com.unity.burst@1.8.15\Editor\BurstAotCompiler.cs:1985
at Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Collections.Generic.IReadOnlyDictionary2[TKey,TValue] environment) [0x00087] in .\Library\PackageCache\com.unity.burst@1.8.15\Editor\BurstAotCompiler.cs:1843 at Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunManagedProgram (System.String exe, System.String args, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Collections.Generic.IReadOnlyDictionary
2[TKey,TValue] environment) [0x00000] in .\Library\PackageCache\com.unity.burst@1.8.15\Editor\BurstAotCompiler.cs:1806
at Unity.Burst.Editor.BurstAotCompiler.OnPostBuildPlayerScriptDLLsImpl (Unity.Burst.Editor.BurstAotCompiler+BurstAOTSettings settings, UnityEditor.Compilation.Assembly[ ] playerAssemblies) [0x00989] in .\Library\PackageCache\com.unity.burst@1.8.15\Editor\BurstAotCompiler.cs:912
at Unity.Burst.Editor.BurstAOTCompilerPostprocessor.DoGenerate (UnityEditor.Compilation.Assembly[ ] assemblies) [0x00013] in .\Library\PackageCache\com.unity.burst@1.8.15\Editor\BurstAotCompiler.cs:353
at Unity.Burst.Editor.BurstAOTCompilerPostprocessor.GenerateNativePluginsForAssemblies (UnityEditor.Build.IGenerateNativePluginsForAssemblies+GenerateArgs args) [0x0006a] in .\Library\PackageCache\com.unity.burst@1.8.15\Editor\BurstAotCompiler.cs:192
at UnityEditor.Modules.BeeBuildPostprocessor.GenerateNativePluginsForAssemblies (PlayerBuildProgramLibrary.Data.GenerateNativePluginsForAssembliesArgs args) [0x00050] in <8e887700cd7e4674989da7b046e8eaa6>:0
at Bee.BeeDriver.BuildRequest+<>c__DisplayClass63_0`1[T].b__0 (System.Object o) [0x00000] in <3f5bd82a14d442d9848a73363c91f22e>:0
at Bee.BeeDriver.BeeDriver_RunBackend+<>c__DisplayClass1_0.b__0 () [0x00021] in <3f5bd82a14d442d9848a73363c91f22e>:0
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in :0
at System.Threading.Tasks.Task.Execute () [0x00000] in :0
— End of stack trace from previous location where exception was thrown —
at Bee.BeeDriver.BeeDriver_RunBackend.ProcessRPCRequest (Bee.BinLog.RPCActionMessage msg, Bee.BeeDriver.BuildRequest+RPCCallback rpcCallback, IPCConnection ipcConnection, System.Threading.Tasks.Task writePipeConnectionTask, Bee.BeeDriver.InternalState state) [0x00102] in <3f5bd82a14d442d9848a73363c91f22e>:0 7
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Error4
Build completed with a result of ‘Failed’ in 41 seconds (41256 ms)
3 errors
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)