[Mono-bugs] [Bug 47916][Blo] New - Custom attributes on parameters are lost
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 26 Aug 2003 11:01:42 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by reali@acm.org.
http://bugzilla.ximian.com/show_bug.cgi?id=47916
--- shadow/47916 2003-08-26 11:01:42.000000000 -0400
+++ shadow/47916.tmp.18845 2003-08-26 11:01:42.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 47916
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Blocker
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: reali@acm.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Custom attributes on parameters are lost
+
+Description of Problem:
+Custom Attributes on the parameters of a method are discarded (the dll
+does not report them). This prevents IIOP.NET (http://iiop-
+net.sourceforge.net/) from running with mono.
+
+Steps to reproduce the problem:
+1. compile the class attached
+2. check with the disassembler or run the class itself
+
+Actual Results:
+no custom attributes are found on the method parameter's (using MS .NET,
+one attribute is found)
+
+Expected Results:
+we expect the attribute to be passed added to the metadata and present in
+the dll
+
+How often does this happen?
+always
+
+Additional Information:
+test this problem using the following class....
+
+using System;
+using System.Reflection;
+
+public class TestAttribute : Attribute {}
+
+public interface TestInterface {
+ void TestMethod([TestAttribute] int[] paramWithAttr);
+}
+
+public class Test {
+ public static void Main(string[] args) {
+ Type ifType = typeof(TestInterface);
+ MethodInfo method = ifType.GetMethod("TestMethod",
+BindingFlags.Public | BindingFlags.Instance);
+ ParameterInfo[] parameters = method.GetParameters();
+ foreach (ParameterInfo param in parameters) {
+ Console.WriteLine("parameter: " + param.Name);
+ object[] testAttrs = param.GetCustomAttributes(true);
+ Console.WriteLine("nr of attributes found: " +
+testAttrs.Length);
+ testAttrs = param.GetCustomAttributes(typeof(TestAttribute),
+true);
+ Console.WriteLine("nr of TestAttributes found: " +
+testAttrs.Length);
+ }
+ }
+}