Odd .Net serialization problem
By : nicklasp
Date : March 29 2020, 07:55 AM
may help you . There is a pattern (for XmlSerializer), that a property Foo will also look for either "bool FooSpecified", or "bool ShouldSerializeFoo()" - and if found, only serialize Foo if this other member returns true. So I assume that agencyIdSpecified had never been set to true? Removing this member would make it always serialize (unless you add a [DefaultValue] or similar). This type of behaviour is used to model optional values on the occasion that we really need to know whether it was in the original data - i.e. does it have the value 0 because the caller told us that number, or because that is simply the default.
|
Serialization problem
By : elmax
Date : March 29 2020, 07:55 AM
will be helpful for those in need I assume you are using BinaryFormatter? This serializer is notoriously brittle, since it (by default) includes the field-name in the stream; this impacts obfuscation particularly badly. Presumably the obfuscator is now choosing new named for the fields (perhaps at random, perhaps due to the new fields), and so it can't deserialize correctly. A few options:
|
WCF Serialization Problem
By : Nagaseshu Kumar
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Has FamilyConfiguration changed? I have seen serialization break because of a changed parent-child relationship. Specifically, the child can not have an Association to its parent. That would be my first guess without being able to see the classes themselves. EDIT: You can write a small console app that serializes and deserializes your objects using the DataContractSerializer explicitly to find out if serialization is the problem.
|
C# XML Serialization Problem
By : user2346453
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further What if you load the stream directly without manually reading it or converting it? code :
XmlDocument xd = new XmlDocument();
xd.Load( stream );
|
Problem in serialization of derived class pointer into a vector with boost::serialization
By : user2968748
Date : March 29 2020, 07:55 AM
I hope this helps you . A part of the problem might be the behaviour of std::shared_ptr in case of derived classes. So it is necessary for you to replace the std::shared_ptr with just a normal pointer. code :
struct A
{
};
struct B : public A
{
};
void fun(const std::shared_ptr<A>& base)
{
std::cout << typeid(base).name() << std::endl;
}
int main(int argc, char *argv[]) {
auto a=std::make_shared<A>();
auto b=std::make_shared<B>();
std::cout << typeid(a).name() << std::endl;
std::cout << typeid(b).name() << std::endl;
fun(a);
fun(b);
}
class std::shared_ptr<struct A>
class std::shared_ptr<struct B>
class std::shared_ptr<struct A>
class std::shared_ptr<struct A>
virtual ~Base() {};
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="17">
<containerclass class_id="0" tracking_level="0" version="0">
<data class_id="1" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="2" tracking_level="1" version="0" object_id="_0">
<doublevalue>4.29999999999999982e+00</doublevalue>
<intvalue>6</intvalue>
</item>
<item class_id="3" class_name="Derived" tracking_level="1" version="0" object_id="_1">
<base object_id="_2">
<doublevalue>1.10000000000000009e+00</doublevalue>
<intvalue>2</intvalue>
</base>
<stringvalue>string in derived</stringvalue>
</item>
</data>
</containerclass>
|