Bug 691333

Summary: Query string convesion is unsupported from custom data type.
Product: [Mono] Mono: Class Libraries Reporter: Roman Sakno <sakno>
Component: WCFAssignee: Atsushi Enomoto <atsushieno>
Status: NEW --- QA Contact: Mono Bugs <mono-bugs>
Severity: Major    
Priority: P5 - None    
Version: 2.10.x   
Target Milestone: ---   
Hardware: x86   
OS: Ubuntu   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Roman Sakno 2011-05-03 04:40:53 UTC
User-Agent:       Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

I have a WCF RESTful service(WebHttpBinding) that contains HTTP request handler in the form of service method:
[DataContract]
[TypeConverter(typeof(ComplexConverter))]
public sealed class Complex
{
  [DataMember]
  public double Image;
  [DataMember]
  public double Real;
}
[ServiceContract]
public interface IArithmeticService
{
  [OperationContract]
  [WebGet("?x={x}&y={y}", RequestFormat = WebMessageFormat.Json, WebMessageFormat.Json)]
  Complex Add(Complex x, Complex y);
}
ComplexConverter is derived from System.ComponentModel.TypeConverter and provide conversion from string to an instance of Complex class and vice versa. This requirement is implemented according with the following article: http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.querystringconverter.aspx(phrase "Types that have a TypeConverterAttribute that can convert the type to and from a string representation").
On Microsoft .NET, operation dispatcher receives query string, and converts each parameter using ComplexConverter from string to an instance of Complex class. Mono doesn't support this feature.

Reproducible: Always

Steps to Reproduce:
1. Write custom data type T;
2. Create a new class derived from TypeConverter class and implements conversion between string and T;
3. Decorate T class with TypeConverterAttribute;
4. Create WCF RESTful service with service method that handles HTTP parametrized request and accepts argument of T class;
5. Invoke service method from browser or client program;
Actual Results:  
Exception Conversion from the argument parameterType 'Company.Product.Type' is not supported at System.ServiceModel.Dispatcher.QueryStringConverter.ConvertStringToValue (System.String parameter, System.Type parameterType) 

Expected Results:  
WebDispatchMessageFormatter obtains TypeConverterAttribute and instantiates converter for custom data type, then converts string to an instance of custom data type and invokes service method successfully.