Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Burst won’t let me create a dev build when using Generic Default Interface Functions

Discussion in 'Burst' started by Explaysive, May 17, 2024.

  1. Explaysive

    Explaysive

    Joined:
    Nov 10, 2018
    Posts:
    6
    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?
    1. Setup a fresh project with Entities & Burst
    2. Copy paste the Code
    3. Try to create a development build

    Code (CSharp):
    1. namespace MyNamespace
    2. {
    3.     public partial struct TestSystem : ISystem
    4.     {
    5.         public void OnCreate(ref SystemState state) { }
    6.         public void OnDestroy(ref SystemState state) { }
    7.  
    8.         [BurstCompile]
    9.         public  void OnUpdate(ref SystemState state)
    10.         {
    11.             var graph = new MyGenericGraph<MyGridCell>();
    12.        
    13.             var cell1 = new MyGridCell(0);
    14.             var cell2 = new MyGridCell(1);
    15.        
    16.             graph.DoSomething(cell1, cell2);
    17.         }
    18.     }
    19.  
    20.     public struct MyGenericGraph<TNode> where TNode : unmanaged, IUniqueID
    21.     {
    22.         public bool DoSomething(TNode start, TNode goal)
    23.         {
    24.             return start.DefaultEquals(goal); // <---- This call does not let me build
    25.             //return start.UniqueID == goal.UniqueID; // <---- If I uncomment this line and comment the line above it works
    26.         }
    27.     }
    28.  
    29.     public interface IUniqueID
    30.     {
    31.         public uint UniqueID { get; }
    32.         // Can't build, because of this function
    33.         public bool DefaultEquals<T>(T other) where T : unmanaged, IUniqueID
    34.         {
    35.             return other.UniqueID == UniqueID;
    36.         }
    37.     }
    38.  
    39.     public struct MyGridCell : IUniqueID
    40.     {
    41.         private uint ID;
    42.         public uint UniqueID => ID;
    43.         public MyGridCell(uint id) { ID = id; }
    44.     }
    45. }
    46.  
    Errors:
    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&)

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

    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.IReadOnlyDictionary`2[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].<RegisterRPCCallback>b__0 (System.Object o) [0x00000] in <3f5bd82a14d442d9848a73363c91f22e>:0
    at Bee.BeeDriver.BeeDriver_RunBackend+<>c__DisplayClass1_0.<ProcessRPCRequest>b__0 () [0x00021] in <3f5bd82a14d442d9848a73363c91f22e>:0
    at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <bfbc89a04b6b4dd49c3614d03fc31ce8>:0
    at System.Threading.Tasks.Task.Execute () [0x00000] in <bfbc89a04b6b4dd49c3614d03fc31ce8>: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&)

    Build completed with a result of 'Failed' in 41 seconds (41256 ms)
    3 errors
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
     

    Attached Files: