You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following code ends by System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Drawing' or one of its dependencies. The system cannot find the file specified.'
var serializer = new Hyperion.Serializer();
byte[] serialized;
using (var ms = new MemoryStream())
{
serializer.Serialize(new System.Drawing.Point(10,15), ms);
serialized = ms.ToArray();
}
serializer = new Hyperion.Serializer();
using (var ms = new MemoryStream(serialized))
{
var res = serializer.Deserialize(ms);
}
It is because version, culture and public key of this system assembly is not stored in serialized data.
Only text "System.Drawing.Point, System.Drawing" for type is serialized.
Point of issue can be seen in following code:
var type = Type.GetType("System.Drawing.Point, System.Drawing"); // returns null
var type2 = Type.GetType("System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); // returns Point type
How to store more details for serialization / deserialization process? It would be fine if complete type definition would be serialized and if unable to deserialize more general approach would be used (omitting version, public key)
Thanks for advice.
The text was updated successfully, but these errors were encountered:
Following code ends by System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Drawing' or one of its dependencies. The system cannot find the file specified.'
It is because version, culture and public key of this system assembly is not stored in serialized data.
Only text "System.Drawing.Point, System.Drawing" for type is serialized.
Point of issue can be seen in following code:
How to store more details for serialization / deserialization process? It would be fine if complete type definition would be serialized and if unable to deserialize more general approach would be used (omitting version, public key)
Thanks for advice.
The text was updated successfully, but these errors were encountered: