Crash - Unable to create a SharedStatic for this key

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 :
![9138742--1269439--upload_2023-7-11_10-10-55.png|1686x1061](upload://wWuzIVnRYAh2fJt6sQjuLcQKHWO.png)

I uploaded a bug under number : In-47307

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?

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

It seems that removing the use of native array fixes the burst compilation error :hushed:

1 Like

It might be worth asking on the C# Jobs System forum if that’s a known issue with NativeArray.

1 Like