Empty web service namespace causes a crash


If a web service has an empty namespace ( [WebService(Name = "MyWebService", Namespace = "")] ), the application will crash with an IndexOutOfRangeException. This occurs on line 156 of WSDLGeneratorBusiness.WSDLGenerator.cs, where you'll find this:
if (ns[ns.Length - 1] != '/')
ns is the variable holding the namespace (an empty string), so it attempts to access index -1 of the string, which fails.

Changing that line to the following solves the issue:
if (!String.IsNullOrEmpty(ns) && ns[ns.Length - 1] != '/')
While not specifying a namespace may be ill advised, it's handy for generating WSDL to be used for generating proxy classes. Also, Microsoft's WSE 3.0 supports generating WSDL in this configuration, so some consistency would be nice.


wrote Jun 1, 2016 at 7:03 PM

Resolved with changeset 89827: Add extra check and use latest CommandLineArgumentsParser

stefh wrote Jun 1, 2016 at 7:03 PM

** Closed by stefh 6/1/2016 12:03 PM

wrote Jun 1, 2016 at 7:03 PM

wrote Jun 1, 2016 at 7:03 PM