RimWorld

RimWorld

Adaptive Storage - Global Settings
 This topic has been pinned, so it's probably important
NuanKi  [developer] 20 Jul @ 6:41pm
Bug Reports
When reporting bugs or mod conflicts, please always upload your log file via HugsLib (press Ctrl + F12 directly after the problem happened) and include the link in your message. Without a log file there is no way for me to figure out what exactly is wrong or how to fix it.
< >
Showing 1-8 of 8 comments
RedFlag 23 Jul @ 5:56am 
error happend after apply change for 2*1 Firdge (Reel's Expanded Storage)

<noparse>
Initializing new game with mods:
- brrainz.harmony
- Ludeon.RimWorld
- ka.betterlog
- imranfish.xmlextensions
- Ludeon.RimWorld.Royalty
- Ludeon.RimWorld.Ideology
- Ludeon.RimWorld.Biotech
- Ludeon.RimWorld.Anomaly
- Ludeon.RimWorld.Odyssey
- local.normalPost
- UnlimitedHugs.HugsLib
- adaptive.storage.framework
- NuanKi.AdaptiveStorageGlobalSettings
- OskarPotocki.VanillaFactionsExpanded.Core
- sbz.NeatStorage
- NuanKi.AdaptiveStorageGlobalSettings.zh
- VanillaExpanded.VFEPropsandDecor
- reel.expanded.storage
Unloading 0 Unused Serialized files (Serialized files now loaded: 5)
Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 37022.
Total: 215.211666 ms (FindLiveObjects: 0.993375 ms CreateObjectMapping: 0.845459 ms MarkObjects: 213.333750 ms DeleteObjects: 0.038833 ms)

Exception filling window for AdaptiveStorageGlobalSettings.Dialog_BuildingSettings: System.InvalidCastException: Specified cast is not valid.
[Ref 2E795985]
at AdaptiveStorageGlobalSettings.Dialog_BuildingSettings.FiltersAreEqual (Verse.ThingFilter filterA, Verse.ThingFilter filterB) [0x00074] in <26a78dbbd8604183b350e156aad3d730>:0
at AdaptiveStorageGlobalSettings.Dialog_BuildingSettings.ApplyChanges () [0x000cb] in <26a78dbbd8604183b350e156aad3d730>:0
at AdaptiveStorageGlobalSettings.Dialog_BuildingSettings.DoWindowContents (UnityEngine.Rect inRect) [0x0016d] in <26a78dbbd8604183b350e156aad3d730>:0
at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x001a6] in <b46fda05e8a84d2bad4ab1b9fab01a22>:0
<noparse>
NuanKi  [developer] 23 Jul @ 8:57am 
Will fix shortly
NuanKi  [developer] 23 Jul @ 10:27am 
Fixed!
RedFlag 23 Jul @ 9:43pm 
Originally posted by NuanKi:
Fixed!
thank you
Error in static constructor of AdaptiveStorageGlobalSettings.ASGS_Initializer: System.TypeInitializationException: The type initializer for 'AdaptiveStorageGlobalSettings.ASGS_Initializer' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object
at PerishableSpoilTimeFilter.HarmonyPatches.CopyAllowancesFrom_Postfix (Verse.ThingFilter __instance, Verse.ThingFilter other) [0x00005] in <db47d763c3fe47d686085fb6fe83acee>:0
at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Verse.ThingFilter.CopyAllowancesFrom_Patch1(Verse.ThingFilter,Verse.ThingFilter)
at AdaptiveStorageGlobalSettings.ASGS_Initializer.InitializeAndApplySettings () [0x0017e] in <6aef07ebe62f450c88ecc16058ef6399>:0
at AdaptiveStorageGlobalSettings.ASGS_Initializer..cctor () [0x00001] in <6aef07ebe62f450c88ecc16058ef6399>:0
--- End of inner exception stack trace ---
[Ref 1D28A05C]
(wrapper managed-to-native) System.RuntimeMethodHandle.GetFunctionPointer(intptr)
at System.RuntimeMethodHandle.GetFunctionPointer () [0x00000] in <51fded79cd284d4d911c5949aff4cb21>:0
at HarmonyLib.HarmonySharedState.GetRealMethod (System.Reflection.MethodInfo method, System.Boolean useReplacement) [0x00046] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.HarmonySharedState.GetStackFrameMethod (System.Diagnostics.StackFrame frame, System.Boolean useReplacement) [0x00015] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.Harmony.GetOriginalMethodFromStackframe (System.Diagnostics.StackFrame frame) [0x0000e] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyMod.ExceptionTools.AddHarmonyFrames (System.Text.StringBuilder sb, System.Diagnostics.StackTrace trace) [0x00026] in <a673461a8ef1414ca7b7ebde5c7c6ef9>:0
at HarmonyMod.ExceptionTools.ExtractHarmonyEnhancedStackTrace (System.Diagnostics.StackTrace trace, System.Boolean forceRefresh, System.Int32& hash) [0x00040] in <a673461a8ef1414ca7b7ebde5c7c6ef9>:0
at HarmonyMod.Environment_GetStackTrace_Patch.Prefix (System.Exception e, System.Boolean needFileInfo, System.String& __result) [0x0001d] in <a673461a8ef1414ca7b7ebde5c7c6ef9>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Error_Patch1 (string)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.StaticConstructorOnStartupUtility.CallAll_Patch4 ()
Verse.PlayDataLoader/<>c:<DoPlayLoad>b__4_4 ()
Verse.LongEventHandler:ExecuteToExecuteWhenFinished ()
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent ()
Verse.LongEventHandler:LongEventsUpdate (bool&)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Root.Update_Patch1 (Verse.Root)
Verse.Root_Entry:Update ()

Seems like Perishable Spoil Time Filter breaks your mod.
It errors during play, and on load.
Also stops the entire Settings GUI to fail.
NuanKi  [developer] 29 Jul @ 11:27am 
Originally posted by Bobbysepp:
Error in static constructor of AdaptiveStorageGlobalSettings.ASGS_Initializer: System.TypeInitializationException: The type initializer for 'AdaptiveStorageGlobalSettings.ASGS_Initializer' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object
at PerishableSpoilTimeFilter.HarmonyPatches.CopyAllowancesFrom_Postfix (Verse.ThingFilter __instance, Verse.ThingFilter other) [0x00005] in <db47d763c3fe47d686085fb6fe83acee>:0
at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Verse.ThingFilter.CopyAllowancesFrom_Patch1(Verse.ThingFilter,Verse.ThingFilter)
at AdaptiveStorageGlobalSettings.ASGS_Initializer.InitializeAndApplySettings () [0x0017e] in <6aef07ebe62f450c88ecc16058ef6399>:0
at AdaptiveStorageGlobalSettings.ASGS_Initializer..cctor () [0x00001] in <6aef07ebe62f450c88ecc16058ef6399>:0
--- End of inner exception stack trace ---
[Ref 1D28A05C]
(wrapper managed-to-native) System.RuntimeMethodHandle.GetFunctionPointer(intptr)
at System.RuntimeMethodHandle.GetFunctionPointer () [0x00000] in <51fded79cd284d4d911c5949aff4cb21>:0
at HarmonyLib.HarmonySharedState.GetRealMethod (System.Reflection.MethodInfo method, System.Boolean useReplacement) [0x00046] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.HarmonySharedState.GetStackFrameMethod (System.Diagnostics.StackFrame frame, System.Boolean useReplacement) [0x00015] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.Harmony.GetOriginalMethodFromStackframe (System.Diagnostics.StackFrame frame) [0x0000e] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyMod.ExceptionTools.AddHarmonyFrames (System.Text.StringBuilder sb, System.Diagnostics.StackTrace trace) [0x00026] in <a673461a8ef1414ca7b7ebde5c7c6ef9>:0
at HarmonyMod.ExceptionTools.ExtractHarmonyEnhancedStackTrace (System.Diagnostics.StackTrace trace, System.Boolean forceRefresh, System.Int32& hash) [0x00040] in <a673461a8ef1414ca7b7ebde5c7c6ef9>:0
at HarmonyMod.Environment_GetStackTrace_Patch.Prefix (System.Exception e, System.Boolean needFileInfo, System.String& __result) [0x0001d] in <a673461a8ef1414ca7b7ebde5c7c6ef9>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Error_Patch1 (string)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.StaticConstructorOnStartupUtility.CallAll_Patch4 ()
Verse.PlayDataLoader/<>c:<DoPlayLoad>b__4_4 ()
Verse.LongEventHandler:ExecuteToExecuteWhenFinished ()
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent ()
Verse.LongEventHandler:LongEventsUpdate (bool&)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Root.Update_Patch1 (Verse.Root)
Verse.Root_Entry:Update ()

Seems like Perishable Spoil Time Filter breaks your mod.
It errors during play, and on load.
Also stops the entire Settings GUI to fail.

Indeed, the problem is in the other mod itself.

The Harmony patch they added to modify CopyAllowancesFrom is:

public static void CopyAllowancesFrom_Postfix(ThingFilter __instance, ThingFilter other) { MyWorldComponent world = Find.World.GetComponent<MyWorldComponent>(); if (!world.ShowSpoilTime(__instance) || !world.ShowSpoilTime(other)) return; ref IntRange local = ref world.getSpoilTime(__instance); local = world.getSpoilTime(other); }

This patch modifies the vanilla CopyAllowancesFrom method, making it only work when a world is loaded. This causes a crash when it tries to run CopyAllowancesFrom during the initial game startup, this is the part that does it:

MyWorldComponent world = Find.World.GetComponent<MyWorldComponent>();

This, in turn, breaks my mod, since my mod calls CopyAllowancesFrom during the initial game startup (before a world is loaded), which triggers the crash in their patch.

They can fix this by adding a safety check that they already use in the ExposeData_Postfix method:

if (Find.World == null) return;
Last edited by NuanKi; 29 Jul @ 11:40am
NuanKi  [developer] 29 Jul @ 11:39am 
So probably I will add an incompatibility tag for it
And I'll go and bring this to their attention.
< >
Showing 1-8 of 8 comments
Per page: 1530 50