SpikeHimself/XPortal

Latest version throws error, wont allow world to load. Reverting to .15 everything is OK.

kmGaijin opened this issue · 14 comments

Describe the bug

  • When loading game with .16 version, this error is thrown and the world fails to l,oad.
[Error  : Unity Log] 09/11/2023 16:21:31: Exception while loading world C:/Users/Tim/AppData/LocalLow/IronGate/Valheim/worlds_local/HRPlaythrough.db:System.NullReferenceException: Object reference not set to an instance of an object
  at XPortal.Patches.ZDOMan_ConnectPortals.Postfix () [0x000f8] in <de0320a6adfa41e6b474e1fd8a07f9bc>:0
  at (wrapper dynamic-method) ZDOMan.DMD<ZDOMan::ConnectPortals>(ZDOMan)
  at (wrapper dynamic-method) ZDOMan.DMD<ZDOMan::Load>(ZDOMan,System.IO.BinaryReader,int)
  at ZNet.LoadWorld () [0x000cf] in <447b19510f604ca3807cd6cce3a7c1ef>:0

To Reproduce

  • Installed latest update via Thunderstore and trioed to load the world I had saved last night with ver .15

Expected behaviour

  • Expected to load up world with new .16 version of XPortal

Version

  • 1.2.16

Environment
Choose from the following options where you are experiencing the problem (leave only the ones you know about):

  • Singleplayer

Priority

  • High
  • ...I reverted to .15 and the world loads fine.

Additional information

  • Also using Randy Knapps 'Advanced Portals'

  • Ver .15 had an issue where every time I would log out, anything other than vanilla wood portals would no longer show up in XPortal and the portals themselves would have no name and no destination. I had to manually set them each play session.

Was able to load a previous world and use ver .16.

Hi @kmGaijin thank you for reporting this.

Could you download the Debug release, enable Debug Logging, and then show me the error again with those?

You can find the Debug release here: https://github.com/SpikeHimself/XPortal/releases/download/v1.2.16/XPortal-debug-v1.2.16.zip

You can find a guide to enabling debug logging here: https://github.com/SpikeHimself/resources/wiki/BepInEx:-Enable-debug-logging

This way the error in your log file will be more verbose and hopefully help me find the cause.

p.s. you can just drag your LogOutput.log file onto your comment -- it will attach the file

Loaded up debug version, enabled logging as instructed.

https://i.imgur.com/NvHoOjt.jpeg
LogOutput.log

Thanks for that @kmGaijin, but it seems that your game still loaded up the "normal" XPortal dll. Are you sure your mod manager isn't replacing the .dll file from the debug release?

Regardless, I have a rough idea of why XPortal crashes. I created a new debug release, please test using this:
XPortal-debug-1.2.17-issue68-01.zip

Please note that this version stops the game from crashing (at least, that's the aim), but it does not take away the root cause of the error. I don't know what that is, and I don't think it's related to XPortal.

When the game loads, XPortal fetches a list of all the portals in your world, so that it can restore their connections. However, in your case, one of those objects has an invalid ZDOID (that's the unique identifier that the game uses). This should be impossible in normal cases, and so my guess is that another mod is creating an issue at an earlier point.

Hrm, redid everything, ensuring only the debug version of XPortal was installed.
Same result. Here's the log file.
LogOutput.log

Sorry, didnt refresh page and didnt realized you posted a .17 debug. Need me to run it with that version?

Hi @kmGaijin, please ignore my previous comment, it was largely incorrect (your new logfile contained the information I was looking for!).

This new debug version should fix it, please let me know if that is the case:

XPortal-debug-1.2.17-issue68-02.zip

Loaded cleanly.

LogOutput.log

Where does XPortal store Portal name and destination info?

I had been having an issue where each time I logged out, all info was wiped for any portal that was not a standard vanilla wooden portal.

This is what I'm getting now.
https://i.imgur.com/6JDq98h.jpeg

Hi @kmGaijin thanks for confirming, I will create a new hotfix release based on this ASAP. Thank you very much for your assistance and swift replies!

Where does XPortal store Portal name and destination info?

They are stored in the ZDO object using custom properties. The name/tag is stored in the "tag" property (equal to vanilla behaviour), the destination is stored in the custom "XPortal_TargetId" property.

These values are saved into your world file, this is done automatically by the game itself.

portalZDO.Set("tag", updatedPortal.Name);
portalZDO.SetOwner(ZDOMan.GetSessionID());
portalZDO.Set(XPortal.Key_TargetId, updatedPortal.Target);

This is what I'm getting now.
https://i.imgur.com/6JDq98h.jpeg

The weird text you're seeing suggests that the translation files didn't load. I can indeed confirm that your logfile does not mention them. This is most likely a result of you removing the original XPortal release and replacing it with the debug release (which ships without the translation files).

I'll finish up the 1.2.17 hotfix and I'll tag you again here when it's available. Give me a few minutes :)

No problem. Glad I could help.

Thanks, Spike.

Hi @kmGaijin, v1.2.17 is now available in the usual places:

You can now delete the files that came from the debug releases. You can also disable debug logging again if you wish (leaving it on causes no harm).

Thanks, Spike!