I had originally implemented a serialization using BinaryFormatter because i needed the result as a byte array. It all work well when running in nUnit, but when i moved it to my medium trust web application it failed. This was due to apparently, the use of reflection in the BinaryFormatter when it serializes all of the object graph properties, including private fields. The easy way to make it work was to change to using the XmlSerializer.
Interestingly though, the XmlSerializer does not implement the same interface as the BinaryFormatter, so i can't just sub in the constructor. The serialise method has the same parameters which is strange.
Heres the msdn doc on the XmlSerializer:
http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx
And this explains the trust issue:
http://haacked.com/archive/2006/07/09/ConfiguringLog4NetWithASP.NET2.0InMediumTrust.aspx
I really thought there might be a way to set the properties that get serialized, but it looks like a LinkDemand and Security assert is performed right at the start of the internal serialization class, so theres no hope of ever getting this to work.
1 comment:
canada goose, louis vuitton, replica watches, juicy couture outlet, pandora jewelry, canada goose, ugg,uggs,uggs canada, doudoune moncler, canada goose outlet, canada goose uk, canada goose jackets, louis vuitton, moncler outlet, barbour, pandora charms, ugg, moncler, louis vuitton, ugg uk, lancel, barbour uk, marc jacobs, moncler, links of london, karen millen uk, toms shoes, swarovski, wedding dresses, canada goose, louis vuitton, ugg,ugg australia,ugg italia, pandora jewelry, moncler, moncler outlet, supra shoes, hollister, swarovski crystal, thomas sabo, juicy couture outlet, canada goose outlet, moncler uk, pandora uk, coach outlet, ugg pas cher, louis vuitton, montre pas cher, canada goose outlet, moncler
Post a Comment