Skip to content

Releases: pardeike/HarmonyRimWorld

Harmony Mod for RimWorld

10 Apr 06:14
Compare
Choose a tag to compare

v2.3.1 optimizes stacktrace handling even for other mods. To use the stacktrace feature, do this in your mod:

using static HarmonyLib.AccessTools;

class MyClass
{
   delegate string ExtractHarmonyEnhancedStackTraceDelegate(StackTrace trace, bool forceRefresh, out int hashRef);
   static readonly MethodInfo m_ExtractHarmonyEnhancedStackTrace = Method("HarmonyMod.ExceptionTools:ExtractHarmonyEnhancedStackTrace", [typeof(StackTrace), typeof(bool), typeof(int).MakeByRefType()]);
   static readonly ExtractHarmonyEnhancedStackTraceDelegate ExtractHarmonyEnhancedStackTrace = MethodDelegate<ExtractHarmonyEnhancedStackTraceDelegate>(m_ExtractHarmonyEnhancedStackTrace);

   string Test(StackTrace trace)
   {
      return ExtractHarmonyEnhancedStackTrace(trace, true, out var hash);
   }
}

Note: There are two Harmony tweak values in RimWorld that control the stacktrace behaviour so if you don't want caching or even enhanced stacktraces, you can suppress those features in the dev tools tweak dialog.

ENJOY