Vanilla-Expanded / VanillaExpandedFramework

Vanilla Expanded Framework for RimWorld
Other
69 stars 34 forks source link

cancel error suppression before exceptions #92

Closed CodeOptimist closed 4 months ago

CodeOptimist commented 5 months ago

Hi there! It looks like a user had an issue loading their colony today and were mysteriously missing errors from their logs (there were refs to the original, from the new v1.5 "Anomaly" logging system, but no original). I believe what happened is an exception was thrown during the error suppression, and so error suppression was never canceled. Here's a fix for that that I also use in While You're Up.

This is a pretty difficult thing to remember to account for, that I almost forgot myself. Here's the chat log with the RimWorld troubleshooter that contacted me this morning, and lead us on this little adventure: ~https://discord.com/channels/214523379766525963/1228667345136783360 (If this link works.)~ Error log: https://gist.github.com/HugsLibRecordKeeper/2dad50ae8ea21f6236ac9f630bb43716

I figured a pull request would be the easiest way to deliver the relevant information. Do feel free to aggressively refactor/reject/test/investigate/whatever-you-see-fit. Hope this helps us get through the turbulent patching waters together! 🏄🌊 Thanks for all your work.

CodeOptimist commented 4 months ago

In WYU I repurpose near stock vanilla's Listing_TreeThingFilter & ThingFilter (harmony reverse patch transpiled with unique classnames) as a mod storage building filter to give the user compatibility control. image

But a ThingFilter saved into mod settings gives those "Could not load reference to" errors when the mod is removed and ThingDef disappears (even though it's harmless). image

Which are what my mod suppresses, ~but since I control the ExposeData() method in this case, as it's my own class, I can maybe fix it there and remove my own suppression of these at least.~

(Maybe I should also trim/bake the reverse patches, but I just benchmarked them at only adding 1/10th of a second.)

CodeOptimist commented 4 months ago

Already merged but just a follow-up. I looked into alternatives.

Scribe_Collections.Look() -> ScribeExtractor.DefFromNodeUnsafe() -> DefFromNode() -> "Could not load reference to "

A new option is to patch BackCompatibility.WasDefRemoved() to return true when suppressing, instead of patching Log.Error(). WasDefRemoved is a good name, though BackCompatibility isn't accurate; we're repurposing. I've changed mine in WYU but it's mostly to get people off my back that see I patched Log.Error. 😏

I would guess that the Def loading error is the only one Vanilla Expanded Framework needed to suppress, but I'm not familiar enough to know that 100%. 🩵

Taranchuk commented 4 months ago

It's not only missing defs, there are missing patch worker classes that the game complains about if you remove Regrowth Core or Altered Carbon