Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Crash - Unable to create a SharedStatic for this key

Discussion in 'Burst' started by Sylmerria, Jul 11, 2023.

  1. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    365
    Hi,

    I had a crash after a code modification preventing me to even opening unity.

    Burst error :
    Unexpected error in Burst compilation: System.AggregateException: One or more errors occurred. (System.InvalidOperationException: Unable to create a SharedStatic for this key. This is most likely due to the size of the struct inside of the SharedStatic having changed or the same key being reused for differently sized values. To fix this the editor needs to be restarted.
    This Exception was thrown from a function compiled with Burst, which has limited exception support.


    I had restart my PC, remove burstcache but nothing.

    I know this crash comes from a recent modification from my investigation.
    Burst try compile that code which leads to a crash :
    upload_2023-7-11_10-10-55.png

    I uploaded a bug under number : In-47307
     
    Last edited: Jul 11, 2023
  2. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    282
    Thanks @Sylmerria, we'll look out for the incoming bug.

    I don't see any direct usage of SharedStatic there. Does any of the code you call from there (such as contraint.PenalitiesAsNativeArray()) use SharedStatic?
     
  3. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    365
    Hi Tim!


    The only shareStatic handle on my code is for a custom native collection made by me but the crash doesn't happen at this moment from the call stack.
    Except that I don't use or touch at SharedStatic at all.

    The case number is : IN-47307
     
  4. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    365
    It seems that removing the use of native array fixes the burst compilation error :eek:

    upload_2023-7-13_10-16-51.png
     
    tim_jones likes this.
  5. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    282
    It might be worth asking on the C# Jobs System forum if that's a known issue with NativeArray.
     
    Sylmerria likes this.