Skip to content
This repository was archived by the owner on May 16, 2022. It is now read-only.

Fix inifinite loop during serializer validation (issue #74) and errors in code #76

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nsentinel
Copy link

@nsentinel nsentinel commented Jun 4, 2017

Fix inifinite loop during serializer validation (issue #74)

To be able to use ZeroFormatter with abstract classes with this fix the following requirements must be met:

  • base class abstract members should be marked as [IgnoreFormat]
  • overriding members in derived class must have [Index()] with the proper index.

If abstract base class used as union base additional restriction must be met:

  • union base class can contain only abstract members (should be an abstract class) since serializer ignores all members definitions except for [UnionKey] member during type generation and serialization code jumps to the derived class code.

Maybe these restrictions should be noted in the documentation.

Fix just breaks hierarchy check loop if finds [IgnoreFormat] attribute. Without it, loop infinitely checks base property definition if it not marked as [UnionKey]

…lization got stuck in other case if remove IgnoreIndex attribute from abstract class neuecc#74
@nsentinel nsentinel changed the title Fix inifinite loop during serializer validation (issue #74) Fix inifinite loop during serializer validation (issue #74) and errors in code Jun 4, 2017
@nsentinel
Copy link
Author

Fix stack imbalance after emitting and opcode used to create ArraySegment

Stack imbalance introduced by Loading Local0 Address in last else branch. Probably you thought to use local as a holder for created ArraySegement to build correct parameters order for last GetProxyType call but it not used and instead you finish with local0 address on the stack and local0 value.

I think local0 declaration il.DeclareLocal(typeof(ArraySegment<byte>)); (line 382) can be safely removed too.

You are using call to constructor method to make new ArraySegment<byte> but I think new object op code proper way to do it.

@nsentinel
Copy link
Author

Fix inconsistent method naming used to concatenate string during creation of union exception error message

Error message construction Unknown subtype of Union: ... used indirect logic to determine method to concatenate two strings leads to making call to public static bool Equals(string a, string b) with bool as result instead of public static string Concat(string str0, string str1) to prepare detailed string for Exception constructor.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant