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=80435 --- shadow/80435 2007-01-03 05:10:22.000000000 -0500 +++ shadow/80435.tmp.24224 2007-01-03 05:10:22.000000000 -0500 @@ -0,0 +1,79 @@ +Bug#: 80435 +Product: Mono: Class Libraries +Version: 1.0 +OS: other +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: CORLIB +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: NRE in MonoArrayMethod.ToString + +The following code produces a NRE: + +using System; +using System.Reflection; +using System.Reflection.Emit; +using System.Text; + +class vbnc_bugs +{ + static void Main () + { + AssemblyBuilderAccess access = +AssemblyBuilderAccess.RunAndSave; + TypeAttributes attribs = TypeAttributes.Public; + + AssemblyName name = new AssemblyName ("a"); + AssemblyBuilder assembly = +AppDomain.CurrentDomain.DefineDynamicAssembly (name, access); + + ModuleBuilder module = assembly.DefineDynamicModule ("m", +"test.dll"); + + Type [] myArrayClass = new Type [1]; + Type [] parameterTypes = { typeof (Array) }; + MethodInfo myMethodInfo = module.GetArrayMethod +(myArrayClass.GetType (), "Sort", CallingConventions.Standard, + + null, parameterTypes); + Console.WriteLine(myMethodInfo.ToString ()); + } +} + + + + +Result: +Unhandled Exception: System.NullReferenceException: Object reference not +set to an instance of an object + at System.Reflection.MonoArrayMethod.ToString () [0x00048] in /mono/head/ +mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs:133 + at vbnc_bugs.Main () [0x00000] + + +The following patch worked for vbnc, but I don't know if it's correct or +not: + +--- MonoArrayMethod.cs (revision 69875) ++++ MonoArrayMethod.cs (working copy) +@@ -130,7 +130,10 @@ + parms = parms + ", "; + parms = parms + p [i].ParameterType.Name; + } +- return ReturnType.Name+" "+Name+"("+parms+")"; ++ if (ReturnType != null) ++ return +ReturnType.Name+" "+Name+"("+parms+")"; ++ else ++ return "void ("+parms+")"; + } + } + } _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
