Search Unity

Bug [IN-41353] Burst internal compiler error regarding hash generation

Discussion in 'Burst' started by FaithlessOne, May 17, 2023.

  1. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    315
    I wanted to report the following error which occurrs when accessing a static property in Burst:

    The errror is caused by the following code (shortened a bit):
    Code (CSharp):
    1. [BurstCompile]
    2. public readonly ref struct TestRefStruct<TElement> where TElement : unmanaged
    3. {
    4.   // ...
    5.   public TestRefStruct(TElement element, int itemIndex, int elementIndex)  { /* ... */ }
    6.  
    7.   public static TestRefStruct<TElement> Terminating
    8.   {
    9.     [DebuggerStepThrough] [BurstCompile] get => new(default, -1, -1);
    10.   }
    11.  
    12. }
    13.  
    14. public struct TestStruct
    15. {
    16.   public int X;
    17. }
    18.  
    19. [BurstCompile]
    20. [WorldSystemFilter(WorldSystemFilterFlags.Default)]
    21. public partial struct TestSystem : ISystem
    22. {
    23.   [BurstCompile]
    24.   public void OnUpdate(ref SystemState state)
    25.   {
    26.     var terminating = TestRefStruct<TestStruct>.Terminating;
    27.   }
    28. }
    29.  
    As an additional note, I would really appreciate error messages which are referring to the originating file/code. In my case I ported multiple classes/structs to Burst compatible structs which included a few thousound lines of codes. Finding the cause of this error then was quite frustrating and took hours. Also the Burst file lock bug is still not fixed yet which forced me restarting Unity many times.

    Created a reproduction project in IN-41353.
     
    Last edited: May 17, 2023
  2. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    287
    Thanks @FaithlessOne - and especially thanks for logging the bug with a reproduction project :) We'll keep an eye out for IN-41353 and take a look at this.

    That's great feedback, thank you. Out of interest, do you happen to still have the full error message? The error message should include more details, but probably not enough details - it would be interesting to see what it said though.
     
  3. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    315
    Thanks for lookin into this issue.

    Yes, this is the error I copied from the Edtior Console of my real project. This is still not the full message as you can see the "<message truncated>" at the end so it got stripped somewhere. I was not able to determine something out of this message, because so much types are involved and a couple of types I ported recently.

    But I now see at least the type causing the trouble. IteratorNode<T> is the ref struct containing the static property "Terminating" which is shown in my first post and reproduced in the incident project.
     
  4. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    287
    Unfortunately, the actual error is beyond the <message truncated> bit :) If you open your Editor.log (from the Console panel, you can open the Editor log) then you should be able to see the full error message (although you may not have that available anymore). Somewhere near the bottom of the error message, it should say what the actual underlying exception was, and (sometimes, but not always) the specific entry point that had the problem.
     
  5. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    315
    Okay, thanks for pointing me to the Editor.log. There is the important message clearly. With this information then I would have been able to locate cause of the error immedtiately. Reading the "<message truncated>" in the Editor Console I thought there are only more types to be stated which would not helped me. But now I know better to always look in the Editor.log in such cases. I would still suggest putting important information within error messages at the beginning and not in the middle or end.

    Thats the important part of the error message:
    Full message: