Jump to content
  • Advertisement
Sign in to follow this  
SonicD007

Deserialization error in another application

This topic is 2506 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have no problem with serializing and deserializing from the same application. The problem comes in when I try to serialize from one application and deserialize in the other. Both applications have the same classes that are being serialized/deserialized. Looking at the exception being thrown, I think the problem lies in the assembly info for each project. The level editor project serializes it, then in the tilesettest project, the exception thats thrown complains about the assembly information not being CLevel editor. Any idea how to fix this? Thanks.

Here is exactly what it says:

System.Runtime.Serialization.SerializationException: Unable to find assembly 'Level Editor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()

at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)

at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)

at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)

at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)

at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()

Share this post


Link to post
Share on other sites
Advertisement
Hello SonicD007,

this sounds like you need to make sure both projects reference the same assembly. Are you sure that it is really the same file or did you copy it and may now have different versions?

--GWDev

Share this post


Link to post
Share on other sites
I haven't done anything with the assembly. I just copied the Map class, layer, etc that has to be serialized/deserialized. How do I have my project reference that assembly?

EDIT: after some googling, it seems I need to put the classes I want to serialize/deserialize into a .dll and reference it like that

EDIT2: For anyone in the future that has this problem, I fixed this by putting the classes being serialized/deserialized into a .dll and referencing that .dll in both projects instead of having the source code for the classes in the project tree.

Share this post


Link to post
Share on other sites

I haven't done anything with the assembly. I just copied the Map class, layer, etc that has to be serialized/deserialized. How do I have my project reference that assembly?


Yes, that is what i meant. So it is not the same assembly.
Just add the output from the project with the Map-class in it as a reference to the other project. This might be unwise if you only need one class out of a large project. In that case you can move your class files to a game lib project in the solution and reference the build output. Now Visual Studio makes sure to rebuild if there were changes to the dll.


EDIT: after some googling, it seems I need to put the classes I want to serialize/deserialize into a .dll and reference it like that


Yes, this is one way to do it.


EDIT2: For anyone in the future that has this problem, I fixed this by putting the classes being serialized/deserialized into a .dll and referencing that .dll in both projects instead of having the source code for the classes in the project tree.


Make sure you only have one location from where all the time for every project only the most recent version is referenced. Maybe even build the dll directly to that location.

--GWDev

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!