[Mono-dev] Fixes for Grasshopper compilation

Eyal Alaluf eyala at mainsoft.com
Thu Sep 8 11:32:21 EDT 2005


Hi, all.

I am not sure where the bug is. It happens only with attributes inheriting from
System.ComponentModel.CategoryAttribute, and as far as I can see CategoryAttribute has a
default usage attribute.
It could even be an MS bug, or it could (probably) be some difference between how
CategoryAttribute is defined in .Net and in Mono.
The attached 'x.cs' does not compile using csc and compiles with mcs. If you think it's
a bug I will file it with this sample.

Eyal.

On Thu, 8 Sep 2005, Ben Maurer wrote:

> Date: Thu, 08 Sep 2005 11:15:49 -0400
> From: Ben Maurer <bmaurer at ximian.com>
> To: Eyal Alaluf <eyala at mainsoft.com>
> Cc: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] Fixes for Grasshopper compilation
>
> On Thu, 2005-09-08 at 16:27 +0300, Eyal Alaluf wrote:
> > Hi, all.
> >
> > Attached are fixes to WebCategoryAttribute.cs & WebSysDescriptionAttribute.cs that mark
> > them as "[AttributeUsage(AttributeTargets.All)]". The MS C# compiler refused to compile
> > System.Web otherwise (from within Grasshopper).
> > The fix seems innocent enough, though. Any comments?
>
> Is this an mcs bug? If so, can you file it?
>
> -- Ben
>
>
-------------- next part --------------
using System;

using System.ComponentModel;



public class MySimpleAttribute : Attribute { }

internal class MySimple2Attribute : MySimpleAttribute { }

internal class MySimple3Attribute : CategoryAttribute { }



[MySimple2()]

[MySimple3()]

public class Test

{

	public static void Main()

	{

		Type t = typeof(CategoryAttribute);

		Object[] a = t.GetCustomAttributes(typeof(AttributeUsageAttribute), true);

		for (int i = 0; i < a.Length; i++) {

			AttributeUsageAttribute x = (AttributeUsageAttribute) a[i];

			Console.WriteLine("{0} {1}", x.ValidOn, x.Inherited);

		}

	}

}



More information about the Mono-devel-list mailing list