Public Group

# 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.

## 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.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.Run()

##### Share on other sites
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 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 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

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633663
• Total Posts
3013236
×