Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Burst Inspector Error - Could not load inspector/Attempting to insert same key: Unity.Jobs.IJob

Discussion in 'Burst' started by pikminscience, Sep 25, 2021.

  1. pikminscience

    pikminscience

    Joined:
    Mar 26, 2019
    Posts:
    36
    Hey,

    Feel like I'm missing something here - just been using burst since yesterday. Created my first Job and it's using [BurstCompile]. Everything is fast WAHOO!

    But trying to open the burst inspector I get this error:

    Code (CSharp):
    1. Could not load Inspector: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: An item with the same key has already been added. Key: Unity.Jobs.IJob
    2.   at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000c1] in <695d1cc93cca45069c528c15c9fdd749>:0
    3.   at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
    4.   at Unity.Burst.Editor.BurstReflection.FindExecuteMethods (System.Collections.Generic.List`1[T] assemblyList, Unity.Burst.Editor.BurstReflectionAssemblyOptions options) [0x0008e] in \Editor\BurstReflection.cs:69
    5.   at Unity.Burst.Editor.BurstInspectorGUI+<>c__DisplayClass33_0.<OnEnable>b__1 () [0x00000] in Library\PackageCache\com.unity.burst@1.5.4\Editor\BurstInspectorGUI.cs:152
    6.   at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <695d1cc93cca45069c528c15c9fdd749>:0
    7.   at System.Threading.Tasks.Task.Execute () [0x00010] in <695d1cc93cca45069c528c15c9fdd749>:0
    8.    --- End of inner exception stack trace ---

    Using Burst 1.5.6 (tried on 1.5.4 also) with Unity 2020.3.14f1. Jobs @ Version 0.11.0-preview.6
     
  2. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    We'll need a repro for this - maybe our method resolving has a bug that we're not aware of!
     
  3. pikminscience

    pikminscience

    Joined:
    Mar 26, 2019
    Posts:
    36
    Aha - seems to be an issue when the project is in Nintendo Switch dev environment.

    Just logging a bug now!
     
    tatoforever and sheredom like this.
  4. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    I still have this issue in Unity 2019.4.40LTS, JOBS 0.2.10preview.13, Mathematics 1.1.0 and Collections 0.9.0preview.6. Full error:
    Code (CSharp):
    1. Could not load Inspector: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: An item with the same key has already been added. Key: Unity.Jobs.IJob
    2.   at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000c1] in <eae584ce26bc40229c1b1aa476bfa589>:0
    3.   at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0
    4.   at Unity.Burst.Editor.BurstReflection.FindExecuteMethods (System.Collections.Generic.List`1[T] assemblyList, Unity.Burst.Editor.BurstReflectionAssemblyOptions options) [0x0009c] in M:\PROJECT FM DE\Library\PackageCache\com.unity.burst@1.7.4\Runtime\Editor\BurstReflection.cs:70
    5.   at Unity.Burst.Editor.BurstInspectorGUI+<>c__DisplayClass51_0.<OnEnable>b__1 () [0x00001] in M:\PROJECT FM DE\Library\PackageCache\com.unity.burst@1.7.4\Editor\BurstInspectorGUI.cs:222
    6.   at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <eae584ce26bc40229c1b1aa476bfa589>:0
    7.   at System.Threading.Tasks.Task.Execute () [0x00010] in <eae584ce26bc40229c1b1aa476bfa589>:0
    8.    --- End of inner exception stack trace ---
    9. ---> (Inner Exception #0) System.ArgumentException: An item with the same key has already been added. Key: Unity.Jobs.IJob
    10.   at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000c1] in <eae584ce26bc40229c1b1aa476bfa589>:0
    11.   at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0
    12.   at Unity.Burst.Editor.BurstReflection.FindExecuteMethods (System.Collections.Generic.List`1[T] assemblyList, Unity.Burst.Editor.BurstReflectionAssemblyOptions options) [0x0009c] in M:\PROJECT FM DE\Library\PackageCache\com.unity.burst@1.7.4\Runtime\Editor\BurstReflection.cs:70
    13.   at Unity.Burst.Editor.BurstInspectorGUI+<>c__DisplayClass51_0.<OnEnable>b__1 () [0x00001] in M:\PROJECT FM DE\Library\PackageCache\com.unity.burst@1.7.4\Editor\BurstInspectorGUI.cs:222
    14.   at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <eae584ce26bc40229c1b1aa476bfa589>:0
    15.   at System.Threading.Tasks.Task.Execute () [0x00010] in <eae584ce26bc40229c1b1aa476bfa589>:0 <---
    16.  
    17. UnityEngine.Debug:LogError (object)
    18. Unity.Burst.Editor.BurstInspectorGUI/<>c__DisplayClass51_0:<OnEnable>b__2 (System.Threading.Tasks.Task`1<Unity.Burst.Editor.BurstReflection/FindExecuteMethodsResult>) (at Library/PackageCache/com.unity.burst@1.7.4/Editor/BurstInspectorGUI.cs:261)
    19. System.Threading._ThreadPoolWaitCallback:PerformWaitCallback
     
  5. Wolpen

    Wolpen

    Unity Technologies

    Joined:
    Oct 11, 2022
    Posts:
    11
    Hey, which burst version are you on?
    If it's an old version could you try and update it to a never version, and see if the bug still occur?
    This can be done by:
    1. Opening Package Manager
    2. Clicking the plus icon top left corner
    3. Choose "Add package by name.."
    4. Insert:
    - name: com.unity.burst
    - version: 1.8.2
     
  6. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    The higest I can see to install is (1.7.4):
    upload_2022-12-2_5-1-51.png
    And I don't have the "Add package by name" option, this is what I have:
    upload_2022-12-2_5-4-7.png
    I'm on Unity 2019.4.40LTS
     
  7. Wolpen

    Wolpen

    Unity Technologies

    Joined:
    Oct 11, 2022
    Posts:
    11
    I could definitely use a repro for this if possible?

    In regards to upgrading burst: It is possible to switch to a specific version by going into to package manifest, located at something like "root-of-your-project/Packages/manifest.json". Here you can write "1.8.2" next to "com.unity.burst" under dependencies. If "com.unity.burst" is not present, you can add it to the dependency list like:

    Code (CSharp):
    1. "dependencies": {
    2.     "com.unity.burst": "1.8.2",
    3.     // All other dependencies
    4. }
    "
     
  8. Wolpen

    Wolpen

    Unity Technologies

    Joined:
    Oct 11, 2022
    Posts:
    11
    Scratch upgrading to burst 1.8.2.
    It's only supported for editor 2020.3+,
    sry
     
    tatoforever likes this.
  9. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    I can try to upgrade to 2020.3/1.8.2 and see if it works. But only to confirm you if the bug still there or not, we can't move to 2020/2021 due to runtime degradation with Nintendo Switch builds though.