Bug 314196 (MONO55971) - [PATCH] mcs fails to create custom attributes with fields which have array type
Summary: [PATCH] mcs fails to create custom attributes with fields which have array type
Status: RESOLVED FIXED
Alias: MONO55971
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Ben Maurer
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2004-03-23 23:17 UTC by Zoltan Varga
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Patch (2.14 KB, patch)
2004-03-24 22:31 UTC, Thomas Wiest
Details | Diff
smaller test case i am using (300 bytes, text/plain)
2004-03-24 22:36 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:31:25 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".