Bug 540001 - WSDL generation fails in ServiceDebugBehavior
Summary: WSDL generation fails in ServiceDebugBehavior
Status: CONFIRMED
Alias: None
Product: Mono: Class Libraries
Classification: Mono
Component: WCF (show other bugs)
Version: SVN
Hardware: x86-64 Ubuntu
: P5 - None : Normal
Target Milestone: ---
Assignee: Atsushi Enomoto
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-17 17:38 UTC by Dan Shechter
Modified: 2010-05-20 04:50 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---
aenomoto: needinfo? (dans)


Attachments
correct repro (3.91 KB, application/unregisterd-mime-type-to-avoid-ie-mime-sniffing)
2009-11-11 11:33 UTC, Atsushi Enomoto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Shechter 2009-09-17 17:38:40 UTC
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)

Here's the Exception + Stack Trace:
Unhandled Exception: System.Xml.Schema.XmlSchemaException: XmlSchema error: name must be a NCName Related schema item SourceUri: , Line 0, Position 0.
  at System.Xml.Schema.ValidationHandler.RaiseValidationEvent (System.Xml.Schema.ValidationEventHandler handle, System.Exception innerException, System.String message, System.Xml.Schema.XmlSchemaObject xsobj, System.Object sender, System.String sourceUri, XmlSeverityType severity) [0x00000] 
  at System.Xml.Schema.XmlSchemaObject.error (System.Xml.Schema.ValidationEventHandler handle, System.String message, System.Exception innerException, System.Xml.Schema.XmlSchemaObject xsobj, System.Object sender) [0x00000] 
  at System.Xml.Schema.XmlSchemaObject.error (System.Xml.Schema.ValidationEventHandler handle, System.String message) [0x00000] 
  at System.Xml.Schema.XmlSchemaComplexType.Compile (System.Xml.Schema.ValidationEventHandler h, System.Xml.Schema.XmlSchema schema) [0x00000] 
  at System.Xml.Schema.XmlSchema.DoCompile (System.Xml.Schema.ValidationEventHandler handler, System.Collections.Hashtable handledUris, System.Xml.Schema.XmlSchemaSet col, System.Xml.XmlResolver resolver) [0x00000] 
  at System.Xml.Schema.XmlSchema.CompileSubset (System.Xml.Schema.ValidationEventHandler handler, System.Xml.Schema.XmlSchemaSet col, System.Xml.XmlResolver resolver, System.Collections.Hashtable handledUris) [0x00000] 
  at System.Xml.Schema.XmlSchema.CompileSubset (System.Xml.Schema.ValidationEventHandler handler, System.Xml.Schema.XmlSchemaSet col, System.Xml.XmlResolver resolver) [0x00000] 
  at System.Xml.Schema.XmlSchemaSet.Reprocess (System.Xml.Schema.XmlSchema schema) [0x00000] 
  at System.Runtime.Serialization.CollectionTypeMap.GetSchemaType (System.Xml.Schema.XmlSchemaSet schemas, System.Collections.Generic.Dictionary`2 generated_schema_types) [0x00000] 
  at System.Runtime.Serialization.XsdDataContractExporter.Export (System.Type type) [0x00000] 
  at System.ServiceModel.Description.WsdlExporter.GetSchemaElementForPart (System.ServiceModel.Description.MessagePartDescription part, System.Xml.Schema.XmlSchema schema) [0x00000] 
  at System.ServiceModel.Description.WsdlExporter.ExportParameters (System.ServiceModel.Description.MessageBodyDescription msgbody, System.String name, System.String ns) [0x00000] 
  at System.ServiceModel.Description.WsdlExporter.ExportMessageBodyDescription (System.ServiceModel.Description.MessageBodyDescription msgbody, System.String name, System.String ns) [0x00000] 
  at System.ServiceModel.Description.WsdlExporter.ExportContractInternal (System.ServiceModel.Description.ContractDescription contract) [0x00000] 
  at System.ServiceModel.Description.WsdlExporter.ExportEndpoint (System.ServiceModel.Description.ServiceEndpoint endpoint) [0x00000] 
  at System.ServiceModel.Description.ServiceMetadataExtension.get_Metadata () [0x00000] 
  at System.ServiceModel.Description.HttpGetWsdl.GetMetadata (System.ServiceModel.ServiceHostBase host) [0x00000] 
  at System.ServiceModel.Description.HttpGetWsdl..ctor (System.ServiceModel.Description.ServiceMetadataExtension metadata_extn, System.Uri base_uri) [0x00000] 
  at System.ServiceModel.Description.ServiceMetadataExtension.EnsureServiceMetadataDispatcher (System.ServiceModel.Description.ServiceDescription description, System.ServiceModel.ServiceHostBase serviceHostBase, System.ServiceModel.Description.ServiceMetadataExtension sme, System.Uri uri, System.ServiceModel.Channels.Binding binding) [0x00000] 
  at System.ServiceModel.Description.ServiceMetadataExtension.EnsureServiceMetadataHttpChanelDispatcher (System.ServiceModel.Description.ServiceDescription description, System.ServiceModel.ServiceHostBase serviceHostBase, System.ServiceModel.Description.ServiceMetadataExtension sme, System.Uri uri, System.ServiceModel.Channels.Binding binding) [0x00000] 
  at System.ServiceModel.Description.ServiceDebugBehavior.System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior (System.ServiceModel.Description.ServiceDescription description, System.ServiceModel.ServiceHostBase serviceHostBase) [0x00000] 
  at System.ServiceModel.ServiceHostBase.InitializeRuntime () [0x00000] 
  at System.ServiceModel.ServiceHostBase.OnOpen (TimeSpan timeout) [0x00000] 
  at System.ServiceModel.Channels.CommunicationObject.Open (TimeSpan timeout) [0x00000] 
  at System.ServiceModel.Channels.CommunicationObject.Open () [0x00000] 
  at QueryService.Program.Main (System.String[] args) [0x00000] 


This is generated by ServiceDebugBehavior.*HelpEnabled being set to true by default:

The contract looks like this:
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace QueryService
{
  public static class Constants
  {
    public const string QUERY_SERVICE_NS = "http://www.xyz.com/2009/05/QueryService";
  }

  [ServiceContract(Namespace = Constants.QUERY_SERVICE_NS)]
  interface ICatalogQuery
  {   
    [OperationContract]
    BookMetadataList GetBooks(string bookName, string startDate, string endDate, int subIdStart, int subIdEnd, string field);

    [OperationContract]
    PublisherMetadataList GetPublishers();

    [OperationContract]
    BookClassMetadataList GetBookClasses();

    [OperationContract]
    int GetOffsetFromUtc(string publisherCode, string date);

    [OperationContract]
    List<string> GetBooks(string publisherCode, string bookClassCode);

    [OperationContract]
    AdditionalMetadata GetAdditionalMetadata(string bookCode);
  }

  [DataContract(Namespace = Constants.QUERY_SERVICE_NS)]
  public class BookClassMetadata
  {
    [DataMember]
    public string Code;
    [DataMember]
    public string Name;
  }


  [CollectionDataContract(Name = "{0}List", ItemName = "BookClassMetadata",
                           Namespace = Constants.QUERY_SERVICE_NS)]
  public class BookClassMetadataList : List<BookClassMetadata> { }

  [DataContract(Namespace = Constants.QUERY_SERVICE_NS)]
  public class PublisherMetadata
  {
    [DataMember]
    public string Code;
    [DataMember]
    public string Name;
    [DataMember]
    public string TimeZone;
  }

  [CollectionDataContract(Name = "{0}List", ItemName = "PublisherMetadata",
                           Namespace = Constants.QUERY_SERVICE_NS)]
  public class PublisherMetadataList : List<PublisherMetadata> { }

  [DataContract(Namespace = Constants.QUERY_SERVICE_NS)]
  public class BookMetadata
  {
    [DataMember]
    public string Filename;
    [DataMember]
    public int FileIndex;
    [DataMember]
    public DateTime Date;
    [DataMember]
    public int DateInt;
    [DataMember]
    public string Source;
    [DataMember]
    public string BookName;
    [DataMember]
    public string Field;
    [DataMember]
    public int SubId;
    [DataMember]
    public string BookType;
  }

  [CollectionDataContract(Name = "{0}List", ItemName = "BookMetadata",
                          Namespace = Constants.QUERY_SERVICE_NS)]
  public class BookMetadataList : List<BookMetadata> { }

  [DataContract(Namespace = Constants.QUERY_SERVICE_NS)]
  public class AdditionalMetadata
  {
    [DataMember]
    public string BookName;
    [DataMember]
    public double Width;
    [DataMember]
    public double Height;
    [DataMember]
    public string Currency;
    [DataMember]
    public TimeSpan RegularReadTime;
    [DataMember]
    public int RegularReadTimeInt;
    [DataMember]
    public TimeSpan RegularHoldTime;
    [DataMember]
    public int RegularHoldTimeInt;
  }
}


Reproducible: Always

Steps to Reproduce:
1. Try to generate WSDL for this contract

Actual Results:  
The exception above

Expected Results:  
Should not crash and generate the proper WSDL
Comment 1 Atsushi Enomoto 2009-11-11 11:33:43 UTC
Created attachment 326811 [details]
correct repro

The described repro was incomplete, so I have created a complete one.
Comment 2 Atsushi Enomoto 2009-11-11 11:35:09 UTC
The sample repro contains two "GetBooks" operations which looks invalid. It is not about WSDL issue and the actual problem rather likely to happen on .NET too.
Comment 3 Atsushi Enomoto 2010-05-20 04:50:53 UTC
I'll close this as INVALID unless a valid test case is provided.