zymex22 / Project-RimFactory-Revived

Project RimFactory Revived
MIT License
46 stars 34 forks source link

Null Pointer exception with HardcoreSK #554

Closed ottodeluxe closed 2 years ago

ottodeluxe commented 2 years ago

I have been trying to get PRF(R) to work in the HardcoreSK modpack (HSK). I am well aware, that HSK does not officially support adding mods, and that it is not anyone's job jere to provide compatibility.

What happens: Any building that can set its own bills and looks for materials around (auto mason, the furnaces, etc.) throw the following error each tick when a bill is set:

Exception ticking PRF_FurnaceIII1573120 (at (73, 0, 96)): System.NullReferenceException: Object reference not set to an instance of an object at ProjectRimFactory.SAL3.Things.Assemblers.Building_ProgrammableAssembler.TryFindBestBillIngredientsInSet (System.Collections.Generic.List´1[T] accessibleThings, RimWorld.Bill b, System.Collections.Generic.List`1[T] chosen) [0x00001] in <770dad6b3d08499d85b2e3cc0c964225>:0 at ProjectRimFactory.SAL3.Things.Assemblers.Building_ProgrammableAssembler.TryGetNextBill () [0x00074] in <770dad6b3d08499d85b2e3cc0c964225>:0 at ProjectRimFactory.SAL3.Things.Assemblers.Building_ProgrammableAssembler.Tick () [0x0016b] in <770dad6b3d08499d85b2e3cc0c964225>:0 at Verse.TickList.Tick () [0x0015c] in :0

I have checked the source, but cannot tell which parameter is null. I am assuming the null passed to the ReflectionUtility is very much intended. Is there any way to tell a) which mod conflicts and/or b) which parameter is null (and why)

without console log debugging? Disabling other mods to find the culprit is not an option and would probably cause only more harm than good in the context of HSK. If possible, I would like to fix this incompatibility, even if the fix would not get merged neither here or in HSK. RimWorld without PRF just lacks something, especially with a crafting-heavy modpack like HSK.

Other features, as well as S.A.L crafters working a regular workbench worked fine when I tested them, but having the full feature range available would be fantastic.

Sn1p3rr3c0n commented 2 years ago

can you attach a HugsLib log with that error message?

ottodeluxe commented 2 years ago

Here are the logs: https://git.io/JyIBu

I have seen some errors, but none seem to be related at first glance. Mostly dirty load/save logic from MISC Robots, and some research weirdness.

Sn1p3rr3c0n commented 2 years ago

My suspicion is that the method that we try to hit is null. To check this may use the dll included in the zip file, it will print a debug log with the relevant information. ProjectRimFactory.zip

ottodeluxe commented 2 years ago

Thank you for your quick response. I have tried the dll you sent, here are the logs: https://git.io/Jyq8P

Now, machines start working and consume the resources, but throw a null pointer when trying to place the product. I'm guessing something in hardcore SK is modifying the methods which are called, or it's a problem with how recipes are managed?

Sn1p3rr3c0n commented 2 years ago

It appears that you where running an outdated version of PRF. with the new compiled binary the null ref issue is gone from our side.

The issue is now the same as with #519 where the null ref is caused by the Custom UniversalFermenterSK.

Error producing items for Thing_PRF_FurnaceIII1805789: System.NullReferenceException: Object reference not set to an instance of an object
  at UniversalFermenterSK.GenRecipe_PostProcessProductPatch.Prefix (Verse.Thing& product, Verse.Pawn& worker, RimWorld.CompQuality& __state)
  at (wrapper dynamic-method) Verse.GenRecipe.Verse.GenRecipe.PostProcessProduct_Patch3(Verse.Thing,Verse.RecipeDef,Verse.Pawn,RimWorld.Precept_ThingStyle)
  at DMD<>?1212590848.Verse.GenRecipe+<MakeRecipeProducts>d__0.MoveNext_Patch0 (Verse.GenRecipe+<MakeRecipeProducts>d__0 this)
  at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection)
  at ProjectRimFactory.Common.Patch_GenRecipe_MakeRecipeProducts_BonusYield+<Postfix>d__0.MoveNext ()
  at ProjectRimFactory.SAL3.Things.Assemblers.Building_ProgrammableAssembler.ProduceItems ()
  at ProjectRimFactory.SAL3.Things.Assemblers.Building_ProgrammableAssembler.Tick ()

in short something in the UniversalFermenterSK.GenRecipe_PostProcessProductPatch.Prefix Harmony prefix is causing the null ref issue. This binary appears to be provided with Core SK(skyarkhangel.HSK).

unfortunately there is nothing we can do to fix this. the author of patch needs to fix this issue.

ottodeluxe commented 2 years ago

Thank you for the pointer, that is all I needed, I hope. I doubt thre will be a fix from the hardcore SK side, since I doubt they want to include PRF in their pack, but maybe I can wrap my head around the patches and make a pull request with a fix, once I found one.