-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to use custom but failing #56
Comments
The error seems to happen on the <object type="inout(mX.cX)" key="0" line It's failing to unarchive but I have no idea why ;/ |
Here is a reduced test case that seems to also exhibit the same issue: module Issue1; import std.stdio; import orange.serialization.Serializable : nonSerialized; class C class Y(T) : C }
} |
and specifically the code Object newInstance (string name)
} is not able to create the instance of the templated class. |
I have a custom class that is virtually identical to the following:
class X { // add toData/fromData}
class Y(T) : X
{
T Data;
this(T d) { Data = d; }
}
But when I run the code, during deserialization I get the error
Orange\serialization\Serializer.d(1274): Failed to unarchive object of type 'X' with key '0'
The reason I have X and Y is because I can't register Y for every possible type, if I just use Y with no X involved then I get errors about registering Y. Ideally I'd want to use Y!T directly because it would make coding much easier(I won't have to manually figure out the type from X and cast).
I figured that I'd use a base class as a common type and just serialize it. Everything seems to work but the deserialization process seems to fail and I can't figure out why.
The serialized data is:
string TESTINGEverything looks right except the runtime type:
runtimeType="mX.Y!string.Y"
Seems there is an extra Y appended to the end.
Although remove the .Y in the xml fixes nothing.
If I remove the toData and fromData
"The object of the static type "inout(mX.X)" have a different runtime type (mX.Y!string.Y) and therefore needs to either register its type or register a serializer for its type "mX.Y!string.Y".
I'm not sure if I'm doing something wrong or what. Any ideas what it could be?
The text was updated successfully, but these errors were encountered: