WCF knowntypes
-
Curious - for simple array such as string[], if I declare known type from interface, they just won't show on object browser (but other custom/non-System types developed in-house can), thus the infamous:
There was an error while trying to serialize parameter http://CalcProcessWCF:req. The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
I have to resort to set it programmatically from proxy in order to get it working:foreach (var operation in proxy.Endpoint.Contract.Operations) { operation.KnownTypes.Add(typeof(MyDynamicallyAddedKnownType)); }
why... -
Curious - for simple array such as string[], if I declare known type from interface, they just won't show on object browser (but other custom/non-System types developed in-house can), thus the infamous:
There was an error while trying to serialize parameter http://CalcProcessWCF:req. The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
I have to resort to set it programmatically from proxy in order to get it working:foreach (var operation in proxy.Endpoint.Contract.Operations) { operation.KnownTypes.Add(typeof(MyDynamicallyAddedKnownType)); }
why...Ummm... what? You must be doing something wrong.
-
Curious - for simple array such as string[], if I declare known type from interface, they just won't show on object browser (but other custom/non-System types developed in-house can), thus the infamous:
There was an error while trying to serialize parameter http://CalcProcessWCF:req. The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
I have to resort to set it programmatically from proxy in order to get it working:foreach (var operation in proxy.Endpoint.Contract.Operations) { operation.KnownTypes.Add(typeof(MyDynamicallyAddedKnownType)); }
why...You're asking this in the wrong forum. Use the WCF forum instead.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001