Format Exception while reading strings with '/' in it

Discussion and help for Easy Save 3
Post Reply
Deadcow
Posts: 4
Joined: Thu Apr 23, 2020 10:16 am

Format Exception while reading strings with '/' in it

Post by Deadcow »

I'm trying to read Dictionary<string, int>with keys like "Items/Coin" or "Locations/S19"
Saving is ok, but on load I got this error:

Code: Select all

FormatException: Expected '{' or "null", found '1'.
ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System.Char expectedChar) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3JSONReader.cs:357)
ES3Internal.ES3JSONReader.StartReadObject () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3JSONReader.cs:111)
ES3Reader.ReadObject[T] (System.Object obj, ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:236)
ES3Reader.ReadInto[T] (System.Object obj, ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:292)
ES3Types.ES3DictionaryType.ReadInto (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/Collection Types/ES3DictionaryType.cs:133)
ES3Reader.ReadInto[T] (System.Object obj, ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:290)
ES3Reader.ReadInto[T] (System.String key, T obj) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:228)
ES3.LoadInto[T] (System.String key, T obj, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:509)
ES3.LoadInto[T] (System.String key, T obj) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:467)
Gameplay.KnowledgeData.<.ctor>b__0_1 () (at Assets/Sources/Shared/Knowledge/KnowledgeData.cs:16)
Gameplay.SavegameManager.Load () (at Assets/Sources/Shared/Savegame/SavegameManager.cs:18)
Gameplay.Input.InputManager.Tick () (at Assets/Sources/Shared/Input/InputManager.cs:57)
Gameplay.Game.Update () (at Assets/Sources/Shared/Core/Game.cs:64)
Save file content at this point:

Code: Select all

{
	"Book_2_04main Interacted" : {
		"__type" : "System.Collections.Generic.List`1[[Gameplay.Interactive.InteractiveStack, Gameplay.Shared, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]],mscorlib",
		"value" : [
			
		]
	},
	"Items" : {
		"__type" : "System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]],mscorlib",
		"value" : {"Coin":20
		}
	},
	"Knowledge" : {
		"__type" : "System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]],mscorlib",
		"value" : {"Items\/Coin":1,"Locations\/S19":1,"K_ClockmakerMansion\/TimeState":4
		}
	}
}
I tried to handle this cases by replacing "/" with "-->" on save and vice versa on loading, it works but maybe there is some better solution for this

btw I tried this with and without Pretty print JSON option, same result
Last edited by Deadcow on Thu Oct 01, 2020 10:41 am, edited 1 time in total.
Deadcow
Posts: 4
Joined: Thu Apr 23, 2020 10:16 am

Re: Format Exception while reading strings with '/' in it

Post by Deadcow »

Also, when I' switching to Binary_Alpha format this exception is thrown on Save:

Code: Select all

FormatException: This data is not Easy Save Key Value data. Expected property name "value", found "eplay.Shared, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]],mscorlib",
		"value" : [
			
		]
	}".
ES3Internal.ES3BinaryReader.ReadKeyPrefix (System.Boolean ignoreType) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3BinaryReader.cs:68)
ES3Reader.ReadTypeFromHeader[T] () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:302)
ES3Reader+ES3ReaderRawEnumerator+<GetEnumerator>d__2.MoveNext () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:448)
ES3Writer.Merge (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Writers/ES3Writer.cs:464)
ES3Writer.Merge () (at Assets/Plugins/Easy Save 3/Scripts/Writers/ES3Writer.cs:454)
ES3Writer.Save (System.Boolean overwriteKeys) (at Assets/Plugins/Easy Save 3/Scripts/Writers/ES3Writer.cs:480)
ES3Writer.Save () (at Assets/Plugins/Easy Save 3/Scripts/Writers/ES3Writer.cs:472)
ES3.Save[T] (System.String key, T value, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:107)
ES3.Save[T] (System.String key, T value) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:67)
Gameplay.KnowledgeData.<.ctor>b__0_0 () (at Assets/Sources/Shared/Knowledge/KnowledgeData.cs:14)
Gameplay.SavegameManager.Save () (at Assets/Sources/Shared/Savegame/SavegameManager.cs:13)
Gameplay.Input.InputManager.Tick () (at Assets/Sources/Shared/Input/InputManager.cs:52)
Gameplay.Game.Update () (at Assets/Sources/Shared/Core/Game.cs:64)
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Format Exception while reading strings with '/' in it

Post by Joel »

Hi there,

I don't seem to be able to replicate this at my end. Please could you create a basic script which replicates this?

Also just to clarify, Binary_Alpha is currently in alpha and should not be used. You should only use settings which are documented.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply