Skip to content
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

DataCorruptedException when deserializing object with DateTimeOffset property to base class. #10

Open
ilearnf opened this issue Aug 7, 2018 · 1 comment

Comments

@ilearnf
Copy link

ilearnf commented Aug 7, 2018

Code that throws the exception:

[DataContract]
class B : A
{
	[DataMember]
	public DateTimeOffset DateTimeOffset { get; set; }
}

[DataContract]
class A
{
	[DataMember]
	public Guid Guid { get; set; }
}

var b = new B {DateTimeOffset = DateTimeOffset.Now, Guid = Guid.Empty};
var bs = serializer.Serialize(b);
var ad = serializer.Deserialize<A>(bs);

GroBuf's part of StackTrace:

in Read_A_bea5fb9a-e5a8-458d-b989-07e1f3f6a910(IntPtr , Int32& , A& , ReaderContext )
in GroBuf.GroBufReader.Read[T](IntPtr data, Int32& index, Int32 length, T& result) 
in c:\BuildAgent\work\4b2afcefcf307fed\GroBuf\GroBuf\GroBufReader.cs:строка 99
in GroBuf.GroBufReader.Read[T](Byte[] data, T& result) 
in c:\BuildAgent\work\4b2afcefcf307fed\GroBuf\GroBuf\GroBufReader.cs:строка 46
in GroBuf.GroBufReader.Read[T](Byte[] data) 
in c:\BuildAgent\work\4b2afcefcf307fed\GroBuf\GroBuf\GroBufReader.cs:строка 76

Exception - GroBuf.DataCorruptedException {"Unknown type code: 142"} .

@ilearnf
Copy link
Author

ilearnf commented Aug 8, 2018

Also deserialization to class B in this case would work as expected.

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

No branches or pull requests

1 participant