Browse Source

Merge pull request #1055 from josedonizetti/fix_datacontractserializer_tests

validate if attribute is defined before check IsAny
Marek Safar 11 years ago
parent
commit
f2df46f68e

+ 7 - 2
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/DataContractSerializer.cs

@@ -566,9 +566,14 @@ namespace System.Runtime.Serialization
 		}
 #endif
 
-		private bool IsAny() {
+		private bool IsAny ()
+		{
 			var xpa = type.GetCustomAttribute<XmlSchemaProviderAttribute> (true);
-			return xpa.IsAny;
+
+			if (xpa != null)
+				return xpa.IsAny;
+
+			return false;
 		}
 	}
 }