I’m trying to load data for example to deserialize I have a line like this: ShopInventoryData ShopInventoryData = formatter.Deserialize(stream) as ShopInventoryData;
The class was originally named ShopData. Now when loading I get a error saying: SerializationException: Unable to load type ShopData required for deserialization. It’s still trying to access the old class that doesn’t exist even though I have no mention of it in my code, why?
Probably because the saved data says “I need ShopData.”
Is this binary formatter? That might be part of your problem.
Do not use the binary formatter/serializer: it is insecure, it cannot be made secure, and it makes debugging very difficult, plus it actually will NOT prevent people from modifying your save data on their computers.
https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide
I would highly suggest using JSON instead.