Hello, I'm trying to access the CustomAttributeData of a class that has the WebService attribute defined.
If the WebService attribute has a Namespace parameter + any of the other WebSercice parameters defined (Name or Description), it throws a CustomAttributeFormatException "Binary format of the specified custom attribute was invalid." exception.
If the WebService attribute has only the Namespace parameter defined, it works.
If the WebService attribute has does not have the Namespace parameter defined, it works.
The code bellow reproduces the problem, does anybody know if there's a workaround or a hot fix for this
Thanks
Gabo
-------
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Web.Services;
namespace WSAttrExeption
{
internal class Program
{
private static void Main()
{
try
{
IList<CustomAttributeData> cda;
cda = CustomAttributeData.GetCustomAttributes(typeof(Works));
Console.WriteLine(cda.Count);
cda = CustomAttributeData.GetCustomAttributes(typeof(GeneratesError));
Console.WriteLine(cda.Count);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
[WebService(Namespace = "http://mynamespace.com")]
public class Works
{}
[WebService(Namespace = "http://mynamespace.com", Name = "blah")]
public class GeneratesError
{}
}