RimWorld

RimWorld

Need Bar Overflow
1.6
As we know, Hospitality is a very solid mod. So when your mod is in the modlist AND for whatever reason the list is sorted with RimSort, your mod blows up the log.

This does NOT occur for when the list is sorted with RimPy

Here's my modlist - https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3507289931
Here's the RimPy mod ordering - https://pastebin.com/Z5HVFt3z
Here's RimSort's ordering - https://rentry.co/igrarodb

---

Log from a RimSort sorted modlist

---

Error while instantiating a mod of type Hospitality.Mod_Hospitality: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> HarmonyLib.HarmonyException: Patching exception in method static System.Boolean RimWorld.JoyGiver_SocialRelax::TryFindIngestibleToNurse(Verse.IntVec3 center, Verse.Pawn ingester, Verse.Thing& ingestible) ---> System.TypeInitializationException: The type initializer for 'RimWorld.JoyGiver_SocialRelax' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
[Ref 426B3233] Duplicate stacktrace, see ref for original
--- End of inner exception stack trace ---
[Ref 349323CE] Duplicate stacktrace, see ref for original
--- End of inner exception stack trace ---
[Ref B60AE964]
at HarmonyLib.PatchClassProcessor.ReportException (System.Exception exception, System.Reflection.MethodBase original) [0x0013c] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.PatchClassProcessor.Patch () [0x000a0] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.Harmony.<PatchAll>b__10_0 (System.Type type) [0x00007] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.CollectionExtensions.Do[T] (System.Collections.Generic.IEnumerable`1[T] sequence, System.Action`1[T] action) [0x00014] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.Harmony.PatchAll (System.Reflection.Assembly assembly) [0x00006] in <8124cc12bdf242eab0a5f7e7edecf387>:0
at HarmonyLib.Harmony.PatchAll () [0x0001d] in <8124cc12bdf242eab0a5f7e7edecf387>:0
<0x203b652f910 + 0x000da> <unknown method>
(wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in <51fded79cd284d4d911c5949aff4cb21>:0
--- End of inner exception stack trace ---
[Ref B25E6138]
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x0001a] in <51fded79cd284d4d911c5949aff4cb21>:0
at System.Reflection.RuntimeConstructorInfo.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00086] in <51fded79cd284d4d911c5949aff4cb21>:0
at System.Reflection.RuntimeConstructorInfo.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <51fded79cd284d4d911c5949aff4cb21>:0
at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x0022b] in <51fded79cd284d4d911c5949aff4cb21>:0
at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x0009c] in <51fded79cd284d4d911c5949aff4cb21>:0
at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <51fded79cd284d4d911c5949aff4cb21>:0
at Verse.LoadedModManager.CreateModClasses () [0x00085] in <78f29a4eb9bd4773be28b9eaaf6c5df6>:0

---

The log then goes into a catastrophic meltdown of every other object that is unable to access BeautyUtility

---

Exception in ConfigErrors() of SculptureLarge: System.TypeInitializationException: The type initializer for 'RimWorld.BeautyUtility' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object
< >
Showing 1-15 of 19 comments
AmCh  [developer] 2 Jul @ 11:11pm 
I am looking into it! Hopefully I can fix it in 24 hours.
---
Edit 1:
I wrote an optimization for BeautyUtility into the mod for 1.5 because in my own profiling I found that it was quite slow in 1.5. I suspect that's the culprit.
My current hypothesis is that the 1.6 update (either vanilla or Hospitality) changed something that is incompatible with my old optimization patch.
I try to make my mod work regardless of sort order (except obviously bad cases like "before Harmony") so I would investigate a bit for a elegant fix.
If that fails, I can just disable that optimization for 1.6 and keep vanilla behavior.
---
Edit 2:
My BeautyUtility patch appears to not be the problem since the problem occurs sometimes even when I disable it.
---
Edit 3:
I did find a minor bug in my mod that I have just patched and will update later, however I don't see how it can cause those error messages, and the errors still appear even after I patched that bug.
Last edited by AmCh; 3 Jul @ 1:49am
AmCh  [developer] 3 Jul @ 2:08am 
Finding: The errors seem unrelated to my mod.
See either of the following logs: https://gist.github.com/HugsLibRecordKeeper/442052b96cd277eebc947ab02e0a7e8a
https://gist.github.com/HugsLibRecordKeeper/394a77d70e4868c4c7f0fd3e118b990e
You can see that the mod list is identical to your RimSort list, except that I removed the "Need Bar Overflow" mod, yet the error still appeared.
This suggests that something else in your mod list is probably causing the error, not my mod.

Edit: I am looking into what could be probably behind this error, if not my mod.
Last edited by AmCh; 3 Jul @ 2:13am
AmCh  [developer] 3 Jul @ 2:56am 
Tracing down the cause of the error, part 1
I looked into the stacktrace of the error (an example snippet below):

Exception in ConfigErrors() of FC_Auravine: System.TypeInitializationException: The type initializer for 'RimWorld.BeautyUtility' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object
[Ref BA935DC2]
at Verse.GenRadial.get_MaxRadialPatternRadius () [0x00000] in <78f29a4eb9bd4773be28b9eaaf6c5df6>:0

This suggest that a NullReferenceException occurred when getting the Property MaxRadialPatternRadius.

The same seem to be what's happening with Hospitality -- the error says it happens during initialization of RimWorld.JoyGiver_SocialRelax, which calls GenRadial.NumCellsInRadius, which uses MaxRadialPatternRadius. They appear to be caused by the same BUG somewhere.

Edit: formatting
Last edited by AmCh; 3 Jul @ 2:56am
AmCh  [developer] 3 Jul @ 4:01am 
Tracing down the cause of the error, part 2/2
My first reaction was "well some other mod probably patched [MaxRadialPatternRadius] and is causing errors" but Harmony reports no patches applied to that Property -- could this be a vanilla bug? But it doesn't appear in pure vanilla.
I have no idea why that happens, but re-replacing the vanilla method with exactly how it appears to be written in vanilla fixes that error.
AmCh  [developer] 3 Jul @ 5:08am 
I wrote a mini-mod just to patch the error you (moo) are seeing
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3515361006
This is probably going to help your (moo's) modlist and those who use that list, but won't help others because I don't think your error is caused by my mods.
What it does: Modify the vanilla property getter "Verse.GenRadial.MaxRadialPatternRadius" by adding a few checks and return a default value if they fail (which should be impossible in theory but it happens anyways due to reasons I don't understand).
This mini-mod is unlisted on the workshop because I don't think it would help most other people.
---
Edit: The error still inconsistently appear with the Hospitality mod, I couldn't figure out why. I still think that it's probably caused by some other mod in your list (perhaps the same one that messes up the MaxRadialPatternRadius) since my mod doesn't modify any JoyGiver at all, and running with only Hospitality and my mod doesn't give any errors either.
---
With all that said, thank you for playing with my mod(s) and thank you for the feedback!
Last edited by AmCh; 3 Jul @ 5:17am
moo 3 Jul @ 2:44pm 
Thanks for the hard work! I just got home so I'll get to checking the modlist. We also just had another unstable build drop too
moo 3 Jul @ 3:18pm 
WELL. I just noticed something funny. First, without NBO - there are these weird circles all centered on the geothermals. And of course the log of death

https://pasteboard.co/tWggKWPOIWLU.png

I'll try shortly with the fix you sent me
moo 3 Jul @ 3:24pm 
And with the fix, I get no map. Hmmmmmmm

edit - I doubt it's relevant but the fix became the first entry of beautyutility errors:

Exception in ConfigErrors() of default: System.TypeInitializationException: The type initializer for 'RimWorld.BeautyUtility' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
[Ref 4CCEBD81]
at Verse.GenRadial.get_MaxRadialPatternRadius () [0x00023] in <4556be83393e426a90db3db5acdc090b>:0
- PREFIX AmCh.MaxRadialPatternRadiusFix: Boolean MaxRadialPatternRadiusFix.MaxRadialPatternRadiusFix:Prefix(Single& __result)
at Verse.GenRadial.NumCellsInRadius (System.Single radius) [0x00000] in <4556be83393e426a90db3db5acdc090b>:0
<0x1b06bebf700 + 0x00112> <unknown method>
--- End of inner exception stack trace ---
[Ref C6FC703D]
at Verse.ThingDef+<ConfigErrors>d__398.MoveNext () [0x003b0] in <4556be83393e426a90db3db5acdc090b>:0
at Verse.DefDatabase`1[T].ErrorCheckAllDefs () [0x00065] in <4556be83393e426a90db3db5acdc090b>:0

I'll rip this mod list apart in a hot minute
Last edited by moo; 3 Jul @ 3:26pm
moo 3 Jul @ 3:36pm 
Oh man, so it's something I reported before but it's not solved. Loading the modlist using a RimPy sort works perfect. It's Rimsort's sorting of the modlist that is breaking it. Specific to Hugslib and XML switching places.

SIGHHHH!
Guess I'll pull the dependent mods and test them each
moo 3 Jul @ 5:21pm 
Aha! I'm getting somewhere. Somewhere within this group is the culprit!!!

https://pasteboard.co/XRgmZqjvqTRr.png
moo 3 Jul @ 5:59pm 
I isolated Extra Explosion Effects as the causer of the radius issue.

I am still working on BeautyUtility
moo 3 Jul @ 6:09pm 
Interesting... I'm back to a complete modlist minus EEE and there's no more beautyutility errors
moo 3 Jul @ 6:37pm 
Finally, the most important part. Your mod is clear!
AmCh  [developer] 3 Jul @ 8:55pm 
Extra Explosion Effects... that sound like it
I can totally see an explosion mod trying to modify GenRadial to allow for bigger explosions (vanilla only allows something like 85 cells radius max)


Edit: it doesn't look like the cause.
Last edited by AmCh; 3 Jul @ 9:03pm
moo 3 Jul @ 9:00pm 
I checked the source (it's with the mod), but I couldn't make heads or tails of why it's a problem
< >
Showing 1-15 of 19 comments
Per page: 1530 50