Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by

Persival

Uploaded by

persival

Virus scan

Safe to use

About this mod

A mod to fix a crashing problem that some other mods are causing when a player saves their game. A required mod for Persival's BundleMod.

Requirements
Permissions and credits
Please Note: This mod is not yet compatible with Stardew Valley v1.1

This is a required mod for
Persival's BundleMod

IMPORTANT CAVEAT:
Once you use the XmlSerializerRetool mod and save your game, it will from then on need
the XmlSerializerRetool mod to de-serialize...or "load" from your XML
save file. So if you are leery about using this mod, you should back up
your saved games before installing it.



What it fixes:
This exception may appear in the SMAPI console after your character goes to sleep (saving your game). The crux of the problem is the part in green. The C# Derived "StarValley.Characters.Junimo" class was not included in the type lists in the game's XmlSerializer.

[07:07:15.220 AM] [ERROR] An error occurred in the overridden update loop: System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type StardewValley.Characters.Junimo was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSaveGame.Write35_NPC(String n, String ns, NPC o, Boolean isNullable, Boolean needType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSaveGame.Write63_CommunityCenter(String n, String ns, CommunityCenter o, Boolean isNullable, Boolean needType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSaveGame.Write85_GameLocation(String n, String ns, GameLocation o, Boolean isNullable, Boolean needType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSaveGame.Write127_SaveGame(String n, String ns, SaveGame o, Boolean isNullable, Boolean needType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSaveGame.Write128_SaveGame(Object o)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
   at StardewValley.SaveGame.<getSaveEnumerator>d__0.MoveNext()
   at StardewValley.Menus.SaveGameMenu.update(GameTime time)
   at StardewValley.Game1.updateActiveMenu(GameTime gameTime)
   at StardewModdingAPI.Inheritance.SGame.Update(GameTime gameTime)

So when the game finally goes to save all of the session-persistent data it believes needs to be stored in the XML save file, it finds a Junimo instance in the session and has no clue how to store that data type into an XML file  ...this is what causes the exception above. So we need to tell the XmlSerializer to include that Junimo type class as well as all the other required types, but there are no direct methods (that I could find) by which to modify an existing XmlSerializer instance in this way. So I created a Mod that includes the Jumino class as well as any other complex class I could discern was necessary. The result is a mod that will rarely ever cause the above exception.

Installation Instructions:
Unpack the XmlSerizlizerRetool.zip file into the Mods directory created by SMAPI

Your /mods file structure should look like this:

 ../mods/XmlSerializerRetool/XmlSerializerRetool.dll
 ../mods/XmlSerializerRetool/manifest.json

Required Software:
Stardew Valley v1.07 (Game)
SMAPI v4.0 (Stardew Valley Mod API)