Permalink
Browse files

Fixed a serialization bug

We may try to deserialize into a property that is not writable and fail instead
of just ignoring it if that's the case. Also fixed a bug that will prevent
actions from working if the SoapEnvelope contains a Header element because it
can't figure out how to create a default instance of it.
  • Loading branch information...
1 parent 1f88069 commit 3c10740d644dffd15e2c76d02440edecd72431d2 @stbrowne stbrowne committed with alexkay Feb 14, 2011
View
4 src/Mono.Upnp/Mono.Upnp/Mono.Upnp.Internal/SoapHeader.cs
@@ -35,6 +35,10 @@ class SoapHeader<T>
{
readonly T header;
readonly bool must_understand;
+
+ protected SoapHeader() : this(default(T), false)
+ {
+ }
public SoapHeader (T header, bool mustUnderstand)
{
View
2 src/Mono.Upnp/Mono.Upnp/Mono.Upnp.Xml.Compilation/DelegateDeserializationCompiler.cs
@@ -199,7 +199,7 @@ protected override ObjectDeserializer CreateAttributeAutoDeserializer ()
ElementDeserializer CreateElementDeserializer ()
{
- if (ValueProperty != null) {
+ if (ValueProperty != null && ValueProperty.CanWrite) {
var property = ValueProperty;
var deserializer = GetDeserializerForType (property.PropertyType);
return (obj, context, depth) => property.SetValue (obj, deserializer (context), null);

0 comments on commit 3c10740

Please sign in to comment.