Bug 691333 - Query string convesion is unsupported from custom data type.
Summary: Query string convesion is unsupported from custom data type.
Status: NEW
Alias: None
Product: Mono: Class Libraries
Classification: Mono
Component: WCF (show other bugs)
Version: 2.10.x
Hardware: x86 Ubuntu
: P5 - None : Major
Target Milestone: ---
Assignee: Atsushi Enomoto
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-03 04:40 UTC by Roman Sakno
Modified: 2011-05-03 04:40 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.