TheSniperFan / unityserializer-ng

Resurrection of the discontinued Unity Serializer by Mike Talbot from WhyDoIDoIt.com (Unity 5)
MIT License
61 stars 17 forks source link

Hello - help is at hand! #15

Closed tawmuller closed 8 years ago

tawmuller commented 9 years ago

Apologies for hi-jacking this bug tracker, but i'm interested in contributing to the development of this adopted project. I was using the original package for a good while for mobile and am looking to sure up some gaps to help reinstate this great plugin to working order on mobile.

In keeping with your requests i'm not asking for you to support mobile, but I do have a few questions I'd like to ask you that might help me resolves some issues.

Do you have an email address or other I could contact you through to discuss a few bits?

in good faith my name is Theo and my email is: tawmuller@gmail.com

I look forward to hearing from you.

mrnamwen commented 9 years ago

While I'm not the contributor, I helped diagnose and fix a major bug. What's your questions? Leave them in this thread for the actual project maintainer to have a look at, however.

On Mon, 27 Apr 2015 23:48 tawmuller notifications@github.com wrote:

Apologies for hi-jacking this bug tracker, but i'm interested in contributing to the development of this adopted project. I was using the original package for a good while for mobile and am looking to sure up some gaps to help reinstate this great plugin to working order on mobile.

In keeping with your requests i'm not asking for you to support mobile, but I do have a few questions I'd like to ask you that might help me resolves some issues.

Do you have an email address or other I could contact you through to discuss a few bits?

in good faith my name is Theo and my email is: tawmuller@gmail.com

I look forward to hearing from you.

— Reply to this email directly or view it on GitHub https://github.com/TheSniperFan/unityserializer-ng/issues/15.

tawmuller commented 9 years ago

hey lobby417!

I've been developing a product for iOs for a while now. It is 32bit good to go on mono in Unity however my publisher has made it clear a 64bit version must be submitted in accordance with the wishes of powers that be at Apple. So in short I've my hand forced to use the IL2CPP Unity backend.

I recently moved to this (UnitySerializerNG) from Mike Talbots original product as the former wouldn't even compile for a il2cpp universal build.

All seemed fine in the games operation however when deserializing the data, exceptions are being thrown.

Namely invalid id's are being discovered in the stream being deserialized which are effectively 'InvalidRangeExceptions'

Brace for callstack!

////Error from callstack: BinarySerializer::DeserializeGetName(Entry entry)

Serialization error: System.Exception: Data stream may be corrupt, found an id of [82] when looking a property name id. _PropertyList.Count: 13 at FieldSerializer.DeserializeFields (System.Collections.Generic.Dictionary2 storage, System.Object obj) [0x00000] in <filename unknown>:0 at Serialization.BinarySerializer.DeserializeGetName (Serialization.Entry entry) [0x00000] in <filename unknown>:0 at ICSharpCode.SharpZipLib.Zip.Compression.PendingBuffer.ToByteArray () [0x00000] in <filename unknown>:0 at Serialization.UnitySerializer.DeserializeObject (Serialization.Entry entry, IStorage storage) [0x00000] in <filename unknown>:0 at Serialization.UnitySerializer.DeserializeFields (IStorage storage, System.Type itemType, System.Object o) [0x00000] in <filename unknown>:0 at Serialization.UnitySerializer.DeserializeObjectAndProperties (System.Object o, System.Type itemType, IStorage storage) [0x00000] in <filename unknown>:0 at Serialization.UnitySerializer.DeserializeObject (Serialization.Entry entry, IStorage storage) [0x00000] in <filename unknown>:0 at Serialization.UnitySerializer.Deserialize (System.IO.Stream inputStream, System.Object instance) [0x00000] in <filename unknown>:0 at Serialization.UnitySerializer.Deserialize (System.IO.Stream inputStream) [0x00000] in <filename unknown>:0 at Serialization.UnitySerializer.Deserialize (System.Byte[] bytes) [0x00000] in <filename unknown>:0 at Serialization.UnitySerializer.Deserialize[StoredInformation] () [0x00000] in <filename unknown>:0 at LevelSerializer.LoadNow (System.Object data, Boolean dontDeleteExistingItems, Boolean showLoadingGUI, System.Action1 complete) [0x00000] in :0 at AutoSaveManager+c__Iterator22.MoveNext () [0x00000] in :0 at Replacements.MSCompatUnicodeTable.get_IsReady () [0x00000] in :0 Replacements.MSCompatUnicodeTable:get_IsReady() UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:LogError(Object) Radical:LogError(String, Object) Radical:LogError(String) Serialization.UnitySerializer:Deserialize(Stream, Object) Serialization.UnitySerializer:Deserialize(Stream) Serialization.UnitySerializer:Deserialize(Byte[]) Serialization.UnitySerializer:Deserialize() LevelSerializer:LoadNow(Object, Boolean, Boolean, Action`1)

c__Iterator22:MoveNext() Replacements.MSCompatUnicodeTable:get_IsReady() ///End callstack It would appear to me (with a slight addition exception log) that the index provided for the property being accessed is way, way out of range. I'm not entirely sure how this kind of 'corruption' of the data could have arisen and am generally looking for thoughts. To be clear, I've also copied the save file generated on iOS which generates this error and checked it by loading from it in editor, and the file is valid... it does load,... and I'm left fairly confused! Look forward to any thoughts you may have on this matter. Cheers, Theo
mrnamwen commented 9 years ago

I need to eliminate a few variables first. Can you setup a new project, make a test scene, import and implement unityserializer-ng, and build it for 64-bit iOS? That way, I can see if this is an issue with our code or with yours. However, it seems to me that you haven't generated the shader code. Try what I sent above first.

On Tue, 28 Apr 2015 01:03 tawmuller notifications@github.com wrote:

hey lobby417!

I've been developing a product for iOs for a while now. It is 32bit good to go on mono in Unity however my publisher has made it clear a 64bit version must be submitted in accordance with the wishes of powers that be at Apple. So in short I've my hand forced to use the IL2CPP Unity backend.

I recently moved to this (UnitySerializerNG) from Mike Talbots original product as the former wouldn't even compile for a il2cpp universal build.

All seemed fine in the games operation however when deserializing the data, exceptions are being thrown.

Namely invalid id's are being discovered in the stream being deserialized which are effectively 'InvalidRangeExceptions'

Brace for callstack!

////Error from callstack: BinarySerializer::DeserializeGetName(Entry entry)

Serialization error: System.Exception: Data stream may be corrupt, found an id of [82] when looking a property name id. _PropertyList.Count: 13 at FieldSerializer.DeserializeFields (System.Collections.Generic.Dictionary2 storage, System.Object obj) [0x00000] in :0 at Serialization.BinarySerializer.DeserializeGetName (Serialization.Entry entry) [0x00000] in :0 at ICSharpCode.SharpZipLib.Zip.Compression.PendingBuffer.ToByteArray () [0x00000] in :0 at Serialization.UnitySerializer.DeserializeObject (Serialization.Entry entry, IStorage storage) [0x00000] in :0 at Serialization.UnitySerializer.DeserializeFields (IStorage storage, System.Type itemType, System.Object o) [0x00000] in :0 at Serialization.UnitySerializer.DeserializeObjectAndProperties (System.Object o, System.Type itemType, IStorage storage) [0x00000] in

:0 at Serialization.UnitySerializer.DeserializeObject (Serialization.Entry entry, IStorage storage) [0x00000] in :0 at Serialization.UnitySerializer.Deserialize (System.IO.Stream inputStream, System.Object instance) [0x00000] in :0 at Serialization.UnitySerializer.Deserialize (System.IO.Stream inputStream) [0x00000] in :0 at Serialization.UnitySerializer.Deserialize (System.Byte[] bytes) [0x00000] in :0 at Serialization.UnitySerializer.Deserialize[StoredInformation]() [0x00000] in :0 at LevelSerializer.LoadNow (System.Object data, Boolean dontDeleteExistingItems, Boolean showLoadingGUI, System.Action1 complete) [0x00000] in :0 at AutoSaveManager+c__Iterator22.MoveNext () [0x00000] in :0 at Replacements.MSCompatUnicodeTable.get_IsReady () [0x00000] in :0 Replacements.MSCompatUnicodeTable:get_IsReady() UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:LogError(Object) Radical:LogError(String, Object) Radical:LogError(String) Serialization.UnitySerializer:Deserialize(Stream, Object) Serialization.UnitySerializer:Deserialize(Stream) Serialization.UnitySerializer:Deserialize(Byte[]) Serialization.UnitySerializer:Deserialize() LevelSerializer:LoadNow(Object, Boolean, Boolean, Action`1) c__Iterator22:MoveNext() Replacements.MSCompatUnicodeTable:get_IsReady() ///End callstack It would appear to me (with a slight addition exception log) that the index provided for the property being accessed is way, way out of range. I'm not entirely sure how this kind of 'corruption' of the data could have arisen and am generally looking for thoughts. To be clear, I've also copied the save file generated on iOS which generates this error and checked it by loading from it in editor, and the file is valid... it does load,... and I'm left fairly confused! Look forward to any thoughts you may have on this matter. Cheers, Theo — Reply to this email directly or view it on GitHub https://github.com/TheSniperFan/unityserializer-ng/issues/15#issuecomment-96854178 .
TheSniperFan commented 9 years ago

I'd prefer to have these kinds of discussions open, because it allows other helpful people to chime in. (As already happened)

If there's something and you aren't sure it belongs here: thesniperfan@gmail.com

Now to the issues of iOS devices: I don't own one nor do I plan to change this. This means that I am unable to test myself which makes it hard to accept changes into the main repo. I'm sure you understand.

I'm going to make two rules: Comment your code. Pull requests must describe the issue and the fix. What does this patch fix? Why was the old code broken? How does this patch fix the issue?

This code base is a minefield for me. I have a potential fix for the really old problem of duplication when using lists. Why isn't the fix public? Because I don't know whether it breaks something else yet.

tawmuller commented 9 years ago

Hey guys,

So I'm pleased to say, (it seems) that this was a pre 5.0.1 bug arising from a BinaryReader issue that wasn't being transcompiled properly by il2cpp!

My thinking has been prompted by:

a) a forum thread relating to the wrong return type being asigned to BinaryReader.ReadUInt32() which clearly this relies on to deserialize the stream properly. Thread below: http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551/page-14#post-1971154

b) although Unity Tech. made no actual log of the fix in release notes (As there are many many fixes being made to il2cpp all the time) i did find that by upgrading to Unity 5.0.1 this file is now successfully deserializing.

There are some other issues presenting which are stopping the game resuming properly and as such i'm not sure if this is in my code base or UnitySerializer NG.

I'll confirm my findings on this thread asap, and present my case for recommending that (for iOS 64bit il2cpp at least) this plugin only be used on 5.0.1 and higher.

I'll happily remain a contributor to maintaining this plugin for iOS compatibility for as long as I can as its absolutely awesome and have used the original creators version on a few projects to date.

@lobby417: Thanks for your quick input. I'll let you know how this test presents, as I'll be certainly creating a basic vanilla project to test updates to this plugin. Can I ask what in the call stack made you believe I haven't 'generated the shader code' - as I'm unclear how you've noted this and what I'd do to rectify this?

@TheSniperFan: I've read your source management procedures and requests you emailed me and I'm happy to comply ;)

Will get back to you with findings soon!

Cheers!

TheSniperFan commented 9 years ago

Glad that it solved this problem for you. The way I see it, it just makes matters more complex because the compiler itself (IL2CPP) can be the source of any problem at this point. We need an automated testing procedure.

maconbot commented 9 years ago

Is IL2CPP still an issue or unknown issue? I know you don't have an iOS device to test on.

mrnamwen commented 9 years ago

Don't know. I don't have an iPhone to test with.

TheSniperFan commented 8 years ago

Me neither. Only thing I can do is wait.

TheSniperFan commented 8 years ago

Since I don't know when IL2CPP will ship for real(!), I'll lock this for the time being.