Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.IO.FileNotFoundException: Could not load file or assembly #187

Open
jakubbukaj opened this issue Oct 13, 2020 · 1 comment
Open

Comments

@jakubbukaj
Copy link

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.

@HungryDoctor
Copy link

Experience the same problem but with System.Windows.Media.Imaging.CachedBitmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants