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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=80263 --- shadow/80263 2006-12-14 16:03:51.000000000 -0500 +++ shadow/80263.tmp.28232 2006-12-14 16:03:51.000000000 -0500 @@ -0,0 +1,98 @@ +Bug#: 80263 +Product: Mono: Runtime +Version: 1.2 +OS: Mac OS X 10.3 +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Major +Component: misc +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Getting custom attributes when one attribute was initialized with a params array that includes a string array crashes the runtime + +Please fill in this template when reporting a bug, unless you know what +you are doing. +Description of Problem: +Under certain circumstances, calling MethodInfo.GetCustomAttributes() can +crash the runtime + +The best way to characterize this problem is with code, which I'll +reference in the steps to reproduce and the additional information +sections: + +-- Begin Program.cs -- +using Sytem; +using System.Reflection; + +namespace MonoBug +{ + public class Program + { + static private void Main(string[] args) + { + Assembly assembly = Assembly.GetExecutingAssembly +(); + Type type = assembly.GetType("MonoBug.Program", +true); + MethodInfo info = type.GetMethod("Foo"); + object[] attributes = info.GetCustomAttributes +(false); + foreach (object obj in attributes) + { + Console.WriteLine("Attribute of type {0} +found", obj.GetType().ToString()); + } + } + + [My("blah", new string[] { "crash" }, "additional +parameter")] + public void Foo() + { + } + } + + [AttributeUsage(AttributeTargets.Method)] + class MyAttribute : Attribute + { + public MyAttribute(params object[] arguments) + { + } + } +} +-- End Program.cs + +Steps to reproduce the problem: +1. Enter the code above into a cs file +2. Compile it +3. Run it + +Actual Results: +The runtime will crash; it complains about some sort of unknown type, and +the crash seems to occur in the native code that handles the call to +GetCustomAttributes. As far as I can tell, the constructor for +MyAttribute is never entered. + +Expected Results: +The call to GetCustomAttributes should not crash the runtime, and it +should return the correct attributes. + +How often does this happen? +Every time in MacOS, never in Windows XP SP2 + +Additional Information: + +/Any/ of the following changes to Program.cs will cause the application +to run without any problems: + +1. Remove the prameters "blah" and "additional prameter" from the call to +the constructor of MyAttribute +2. Remove the AttributeUsage attribute from the MyAttribute class +3. Remove all items from the string array (the string "crash") +4. Make the string array an object array +5. Replace the string array with an array of some other type, such as int _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
