Jump to content

  • Log In with Google      Sign In   
  • Create Account

Deserialization error in another application


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 SonicD007   Members   -  Reputation: 464

Like
0Likes
Like

Posted 27 January 2012 - 08:01 PM

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()


Sponsor:

#2 GWDev   Members   -  Reputation: 281

Like
0Likes
Like

Posted 28 January 2012 - 07:35 AM

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

#3 SonicD007   Members   -  Reputation: 464

Like
0Likes
Like

Posted 28 January 2012 - 10:24 AM

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.

#4 GWDev   Members   -  Reputation: 281

Like
0Likes
Like

Posted 31 January 2012 - 10:21 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS