[Mono-list] Custom attributes setting return type

Ravi Pratap M ravi@ximian.com
14 Apr 2003 10:31:00 -0500

Hi Mark,

> ´╗┐manager/BulletinServerProxy.cs(55) warning CS-0024: .NET SDK 1.0 does \
>   not permit to set custom attributes to the return type of a method
> The code in question is:
>   [System.Web.Services.Protocols.SoapRpcMethodAttribute("",
>     RequestNamespace="urn:bulletinwireless.com/appconnect/1.0",
>     ResponseNamespace="urn:bulletinwireless.com/appconnect/1.0")]
>   [return: System.Xml.Serialization.SoapElementAttribute("receiveStatusReturn")]
>   public MessageStatus[] receiveStatus(string application, int environment) 
>   {
>     object[] results = this.Invoke("receiveStatus", new object[] {
>     return ((MessageStatus[])(results[0]));
>   }

	The code seems fine - there is nothing incorrect about it.

> I've just inherited this code and new to .NET/C# so not sure if this is
> correct, however the code compiles fine under Visual Studio.NET.

	The thing is that there is nothing in the Reflection.Emit API (which
the compiler uses to set attributes) which lets one set the attributes
for the return type. This is a bug in the .NET SDK 1.0. Mono, on the
other hand, does provide the appropriate methods so if you compiled this
with the Mono runtime, it would compile with no warnings.