From: Hamza Karamali <[EMAIL PROTECTED]>
I tested with mono-0.19's mcs and with csc, and so it seems like it is bug in mcs. Please fill a bug report in mono's bugzilla.I'm new to Mono: I just downloaded and installed it yesterday, and I'm currently trying to run a couple of programs that compile and run on "normal" Windows .NET. One of my programs uses attributes that take various kinds of arguments:[myAttribute("stringArgument", (String)null, (String)null, 2)] And when compiling the code, I get the following error message: myCode.cs(204) error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression myCode.cs(221) error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression Compilation failed: 2 error(s), 0 warnings Does anyone know why this happens?
As a note: design CLR attributes with multiple constructors, to avoid having to pass null parameters when they can be ommited.
Also: eliminating the cast to string in the null values, makes the error message go away. This form compiles ok with mcs:
[myAttribute("stringArgument", null, null, 2)]
That typecasts are only needed if you have similar constructors for the attribute that may confuse the compiler if not guided by the typecasts.
Happy hackings,
Rafael Teixeira
Brazilian Polymath
Mono, MonoQLE Hacker
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
_______________________________________________
Mono-list maillist - [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list
