RimWorld
Ben Lubar's Android Tiers Patches
SlippyCheeze 12 ABR 2022 a las 8:47 a. m.
[BUG] Exception when SOS2 is not installed
I'm cutting the error only because I tracked down what triggers it – harmony apparently doesn't like the way you handle the "optional" nature of the patch in
ShipInteriorMod2_HasSpaceSuitSlow_Patch.cs
or something.

It looks like the "approved" way of making a patch do nothing if there is no target method is using the `Prepare` feature instead: https://harmony.pardeike.net/articles/patching-auxilary.html#prepare and returning false.

I can throw a patch your way, if you want, but I don't have a compiler environment set up for rimworld or anything. That should let you check for the SOS2 mod and disable patching if it isn't present.


[me.lubar.AndroidTiersPatches][ERR] Failed to apply Harmony patches for me.lubar.AndroidTiersPatches. Exception was: HarmonyLib.HarmonyException: Patching exception in method null ---> System.ArgumentException: Undefined target method for patch method static System.Void BenLubarsAndroidTiersPatches.ShipInteriorMod2_HasSpaceSuitSlow_Patch::Postfix(System.Boolean& __result, Verse.Pawn pawn) at HarmonyLib.PatchClassProcessor.PatchWithAttributes (System.Reflection.MethodBase& lastOriginal) [0x00047] in <afae5a8d84e24373b604e1b6d209d116>:0 at HarmonyLib.PatchClassProcessor.Patch () [0x00068] in <afae5a8d84e24373b604e1b6d209d116>:0 --- End of inner exception stack trace --- at HarmonyLib.PatchClassProcessor.ReportException (System.Exception exception, System.Reflection.MethodBase original) [0x00127] in <afae5a8d84e24373b604e1b6d209d116>:0 at HarmonyLib.PatchClassProcessor.Patch () [0x00093] in <afae5a8d84e24373b604e1b6d209d116>:0 at HarmonyLib.Harmony.<PatchAll>b__10_0 (System.Type type) [0x00007] in <afae5a8d84e24373b604e1b6d209d116>:0 at HarmonyLib.CollectionExtensions.Do[T] (System.Collections.Generic.IEnumerable`1[T] sequence, System.Action`1[T] action) [0x00014] in <afae5a8d84e24373b604e1b6d209d116>:0 at HarmonyLib.Harmony.PatchAll (System.Reflection.Assembly assembly) [0x00006] in <afae5a8d84e24373b604e1b6d209d116>:0 at HugsLib.ModBase.ApplyHarmonyPatches () [0x0009a] in <a56dbe2cf5184fe991f5fb736b3081b0>:0
< >
Mostrando 1-5 de 5 comentarios
SlippyCheeze 19 ABR 2022 a las 12:53 a. m. 
FWIW, I added a small patch for myself, and it fixes the problem: no more exception because a null value was received from the target method. Not the absolute minimalist patch, but close enough.

private static Lazy<bool> hasSOS2 => new Lazy<bool>((Func<bool>) (() => System.Type.GetType("SaveOurShip2.ShipInteriorMod2,ShipsHaveInsides", false) != (System.Type) null)); public static bool Prepare() => ShipInteriorMod2_HasSpaceSuitSlow_Patch.hasSOS2.Value;
Scorpio 6 SEP 2022 a las 12:46 p. m. 
Publicado originalmente por SlippyCheeze:
FWIW, I added a small patch for myself, and it fixes the problem: no more exception because a null value was received from the target method. Not the absolute minimalist patch, but close enough.

private static Lazy<bool> hasSOS2 => new Lazy<bool>((Func<bool>) (() => System.Type.GetType("SaveOurShip2.ShipInteriorMod2,ShipsHaveInsides", false) != (System.Type) null)); public static bool Prepare() => ShipInteriorMod2_HasSpaceSuitSlow_Patch.hasSOS2.Value;


can you share the file?
nchorbajian 12 SEP 2022 a las 8:36 p. m. 
I have compiled what SlippyCheeze wrote here and it does not show errors on startup without SOS2
Google Drive [drive.google.com] (gameplay idk if anything changed yet).
Scorpio 13 SEP 2022 a las 2:33 a. m. 
Publicado originalmente por nchorbajian:
I have compiled what SlippyCheeze wrote here and it does not show errors on startup without SOS2
Google Drive [drive.google.com] (gameplay idk if anything changed yet).

strangely still errors here wonder if its because of the SOS2 experimental version?
Última edición por Scorpio; 13 SEP 2022 a las 4:53 a. m.
nchorbajian 13 SEP 2022 a las 3:34 p. m. 
Ah maybe. They did change some stuff on their shipInteriorMod2 source.
< >
Mostrando 1-5 de 5 comentarios
Por página: 1530 50