Skip to content

[Bug]: Calling ThingDef_AlienRace.ResolveReferences again results in an error. #118

Description

@Nathan8489

which required by Hot reload Defs (an vanilla debug action) or some mods else12.

Currently following error message will appear if any thought replacer exists.3 However, this does not mean that the thought replacer is duplicated in XML file.
In fact, the entire ThingDef_AlienRace.ResolveReferences function was executed again.

Could not execute post-long-event action. Exception: System.ArgumentException: An item with the same key has already been added. Key: 57047
[Ref 6FD82834]
[0x00006] in <51fded79cd284d4d911c5949aff4cb21>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000dd] in <51fded79cd284d4d911c5949aff4cb21>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <51fded79cd284d4d911c5949aff4cb21>:0
at AlienRace.ThingDef_AlienRace.<ResolveReferences>b__1_1 () [0x00058] in C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\AlienRaces\Source\AlienRace\AlienRace\ThingDef_AlienRace.cs:283
at Verse.LongEventHandler.ExecuteToExecuteWhenFinished () [0x0007c] in <46372f5dadbf4af8939e608076251180>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Error_Patch2 (string)
Verse.LongEventHandler:ExecuteToExecuteWhenFinished ()
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent ()
Verse.LongEventHandler:LongEventsUpdate (bool&)
Verse.Root:Update ()
Verse.Root_Entry:Update ()

After research all ResolveReferences method in vanilla, I believe it supposed be allowed to be calling repeatedly.

In actual gameplay, duplicates don't seem to cause any problems.

So I'll call it a low priority issue.

Have a good day.

Footnotes

  1. Optimization: Meats - C# Edition (Steam) https://steamcommunity.com/sharedfiles/filedetails/?id=2542931556

  2. Optimization: Meats - C# Edition (GitHub) https://github.com/csh1668/OptimizationMeat/blob/cdaafbeef9d907080f72cbfc61dfc43e4a3d8f32/Source/AlienMeatTest/StaticConstructor.cs#L36-L37

  3. Bug reports on steam https://steamcommunity.com/workshop/filedetails/discussion/839005762/4737210531937056641/?ctp=55#c802345853100503705

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions