Operation interface methods also have ServiceKnownType attributes.
authorAtsushi Eno <atsushi@ximian.com>
Wed, 16 Feb 2011 08:07:10 +0000 (17:07 +0900)
committerAtsushi Eno <atsushi@ximian.com>
Wed, 16 Feb 2011 08:14:05 +0000 (17:14 +0900)
mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs

index 529a395a6783d1ab17a6508b316eac9b2ea79295..8801eb8637b261d5159d3a1a0fa684bbe4fd6e6c 100644 (file)
@@ -283,10 +283,11 @@ namespace System.ServiceModel.Description
                                od.Messages.Add (GetMessage (od, mi, oca, true, isCallback, null));
                                if (!od.IsOneWay)
                                        od.Messages.Add (GetMessage (od, mi, oca, false, isCallback, asyncReturnType));
-                               foreach (ServiceKnownTypeAttribute a in cd.ContractType.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false))
-                                       foreach (Type t in a.GetTypes ())
-                                               od.KnownTypes.Add (t);
-                               foreach (ServiceKnownTypeAttribute a in serviceMethod.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false))
+                               var knownTypeAtts =
+                                                   cd.ContractType.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false).Union (
+                                                   mi.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false)).Union (
+                                                   serviceMethod.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false));
+                               foreach (ServiceKnownTypeAttribute a in knownTypeAtts)
                                        foreach (Type t in a.GetTypes ())
                                                od.KnownTypes.Add (t);
                                foreach (FaultContractAttribute a in mi.GetCustomAttributes (typeof (FaultContractAttribute), false)) {