[Mono-bugs] [Bug 339013] New: New DLR requires [Optional] parameters to have a DefaultValue of System.Reflection.Missing
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun Nov 4 22:10:38 EST 2007
https://bugzilla.novell.com/show_bug.cgi?id=339013
Summary: New DLR requires [Optional] parameters to have a
DefaultValue of System.Reflection.Missing
Product: Mono: Runtime
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Major
Priority: P5 - None
Component: misc
AssignedTo: mono-bugs at ximian.com
ReportedBy: miguel at novell.com
QAContact: mono-bugs at ximian.com
Found By: ---
The new DLR (In particular, for IronRuby) uses a feature we do not have
implemented.
If a parameter is flagged with [System.Runtime.InteropServices.Optional] when
we retrieve the ParameterInfo for a method, the DefaultValue should be
System.Reflection.Missing instead of DBNull.
The following sample should print:
System.DBNull System.Reflection.Missing
Instead it prints:
System.DBNull and System.DBNull
using System;
using System.Reflection;
using System.Runtime.InteropServices;
class X {
static void Main ()
{
ParameterInfo [] pi = typeof (X).GetMethod
("TakesInt").GetParameters ();
Console.WriteLine ("{0} and {1}", pi [0].DefaultValue.GetType
(), pi [1].DefaultValue.GetType ());
}
public static void TakesInt (int b, [Optional] int a)
{
}
}
Found this while tracking down an error reported by John Lam when running the
test suite from IronRuby.
A simple way of reproducing the bug with IronRuby is:
rbx
>>> Dir.glob "*"
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list