jefffhaynes / BinarySerializer

A declarative serialization framework for controlling formatting of data at the byte and bit level using field bindings, converters, and code.
MIT License
291 stars 62 forks source link

Serialization of string stops unexpectedly #90

Open Waelwindows opened 6 years ago

Waelwindows commented 6 years ago

I'm trying to make a (de)serializer for a particular texture format, Every structure in the format starts with a magic of 4 bytes size, however for some odd reason. When I try to deserialize the atlas structure, the serializer just stops serializing mid-string, which causes the entire texture list to be initialized incorrectly.

Here's the log of the serializer: txp2dds_2018-01-27_20-55-28

(the 1st log is the Atlas class texture list, 2nd Log is the first texture in the atlas log but serialized explicitly out of the Atlas class)

When I explicitly try to deserialize the List (just as the serializer should be doing implicitly) It deserializes just fine

jefffhaynes commented 6 years ago

Can you post your code so I can take a look?

— Planning for failure is even dumber than regular planning


From: Waelwindows notifications@github.com Sent: Saturday, January 27, 2018 12:58:04 PM To: jefffhaynes/BinarySerializer Cc: Subscribed Subject: [jefffhaynes/BinarySerializer] Serialization of string stops unexpectedly (#90)

I'm trying to make a (de)serializer for a particular texture format, Every structure in the format starts with a magic of 4 bytes size, however for some odd reason. When I try to deserialize the atlas structure, the serializer just stops serializing mid-string, which causes the entire texture list to be initialized incorrectly.

Here's the log of the serializer: [txp2dds_2018-01-27_20-55-28]https://user-images.githubusercontent.com/5228243/35474812-7b602072-03a4-11e8-8420-2598686473ae.png

(the 1st log is the Atlas class texture list, 2nd Log is the first texture in the atlas log but serialized explicitly out of the Atlas class)

When I explicitly try to deserialize the List (just as the serializer should be doing implicitly) It deserializes just fine

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/BinarySerializer/issues/90, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR1znjGpjwuy69qPNkVpWc8dIml4Fks5tO2OsgaJpZM4RvYZz.

Waelwindows commented 6 years ago

I had to resort to using a function that sets the Atlas class' texture to the explicitly serialized textures. Main.cs TxpTool.cs

jefffhaynes commented 6 years ago

Does that mean the code you posted doesn't reproduce the problem? Looking at what you posted nothing is jumping out at me as wrong but if I can't reproduce the issue it's going to make it difficult to troubleshoot.

jefffhaynes commented 6 years ago

I've tried to put things together to perform the original serialization and it seems to round-trip successfully. Is there any chance there's something weird in the file? It would be helpful if you could post one so I could take a look. One other thing - when you say it "stops" do you mean it hangs, throws an exception, or exits prematurely? Thanks.

Waelwindows commented 6 years ago

It exits prematurely when it deserializes as a member of another class, However, when deserialize by itself inside the same file at the same position, it doesn't

jefffhaynes commented 6 years ago

Ok, I haven’t been able to reproduce this. If you want to post a file along with the exact code that causes the issue I would be happy to take a look. Thanks.

— Planning for failure is even dumber than regular planning


From: Waelwindows notifications@github.com Sent: Sunday, February 11, 2018 5:45:47 PM To: jefffhaynes/BinarySerializer Cc: Jeff Haynes; Comment Subject: Re: [jefffhaynes/BinarySerializer] Serialization of string stops unexpectedly (#90)

It exists prematurely

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/BinarySerializer/issues/90#issuecomment-364797120, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR7eiJATKk9s7yDBgeqxUVXsbGQu0ks5tT22agaJpZM4RvYZz.