Closed GoogleCodeExporter closed 9 years ago
It looks like the TypeSerializer is unable to serialize a System.Type:
typeof (string).SerializeAndFormat();
throws the same exception.
Original comment by daniel.n...@gmail.com
on 16 Jun 2010 at 9:38
Hi,
Yeah it didn't support serializing 'Type' properties because I had to
specifically provide support for it.
I've quickly just added support for it and should now work in v1.32 of
ServiceStack or later.
You can download the latest version from:
http://servicestack.googlecode.com/files/ServiceStack.Text.zip
I've added your example as a test you can see here, so it should hopefully work
for you as well:
http://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Te
xt/ServiceStack.Text.Tests/ReportedIssues.cs
Just a couple of things, you don't need to mark your classes as [Serializable]
and as you might've guessed, 'SerializeAndFormat' uses TypeSerializer
underneath so will exhibit the same behaviour.
Thanks for your feedback. Let me know if the latest version works for you so I
can close this issue.
Cheers,
Demis
Original comment by demis.be...@gmail.com
on 17 Jun 2010 at 1:38
Hello,
the new Assembly fixes the Type problem, but throws again the duplicate key
exception on other objects ;)
I'll investigate today and post a new test case.
@System.Type serialization:
It would be more non-ambiguous if you use type.FullName instead of Type.Name
during serialization.
Thanks for your very fast response.
Original comment by daniel.n...@gmail.com
on 17 Jun 2010 at 5:46
hmmmm, I am using 'Type.FullName', and I'm no longer getting that Exception.
Can you make sure that you're using the latest binary.
Otherwise can you provide some sample code where its failing?
Original comment by demis.be...@gmail.com
on 17 Jun 2010 at 8:19
Sorry, i meant: type.AssemblyQualifiedName
Original comment by daniel.n...@gmail.com
on 17 Jun 2010 at 9:23
Hi,
Try the latest build, it has most of your tests passing (with caveats)
http://servicestack.googlecode.com/files/ServiceStack.Text.zip
I have incorporated your tests into the test suite and have left comments where
I've needed to do work arounds or document limitations
http://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Te
xt/ServiceStack.Text.Tests/DynamicModels/ComplexObjectGraphTest.cs
The important part to remember is since I don't serialize any Type information
with the payload, I will require the Type information to de-serialize it
correctly. e.g. If you serialize an 'object' Property and de-serialize it back
again with an 'object' type it will leave it as the serialized 'string' since
thats a valid object. Now if you store the Type information with the payload
then you have a chance to reconstruct it with the serialized string value.
Check out the last test and it will show you what's possible with Dynamic and
strict types
Can_Serialize_DynamicType_and_Deserialize_into_StrictType()
Let us know if you have any questions?
Cheers,
Demis
Original comment by demis.be...@gmail.com
on 18 Jun 2010 at 2:25
Original comment by demis.be...@gmail.com
on 21 Jun 2010 at 9:04
Original issue reported on code.google.com by
daniel.n...@gmail.com
on 16 Jun 2010 at 9:27