Bugzilla – Bug 314196
[PATCH] mcs fails to create custom attributes with fields which have array type
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by vargaz@freemail.hu 2004-03-23 16:17:17 MST ---- Testcase: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< using System; [AttributeUsage(AttributeTargets.Field | AttributeTargets.Class, Inherited=true)] public class FooAttribute : Attribute { char[] separator2; public FooAttribute(string name) { } public char[] Separator { get { return separator2; } } } [FooAttribute("shortcut",separator2=new char[]{'A'})] public class Tests { public static void Main () { FooAttribute foo = (FooAttribute)(typeof (Tests).GetCustomAttributes (false) [0]); Console.WriteLine (foo.Separator); } } <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Here, mcs reports: custom.cs(19) error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression while csc compiles it fine. ---- Additional Comments From bmaurer@users.sf.net 2004-03-24 15:31:29 MST ---- Created an attachment (id=165788) Patch ---- Additional Comments From bmaurer@users.sf.net 2004-03-24 15:35:00 MST ---- This patch fixes the MCS side of the issue. If I run mcs on the MS.NET runtime, everything works fine. However, there is a bug in the runtime that prevents this from working correctly when mcs is run on linux. ---- Additional Comments From bmaurer@users.sf.net 2004-03-24 15:36:57 MST ---- Created an attachment (id=165789) smaller test case i am using ---- Additional Comments From bmaurer@users.sf.net 2004-06-23 11:56:41 MST ---- *** https://bugzilla.novell.com/show_bug.cgi?id=MONO60637 has been marked as a duplicate of this bug. *** ---- Additional Comments From miguel@ximian.com 2004-06-23 11:58:33 MST ---- fixed, Imported an attachment (id=165788) Imported an attachment (id=165789) Unknown operating system unknown. Setting to default OS "Other".