[Mono-list] Small patch for Delegate.cs
Ricardo Fernández Pascual
rfp1@ono.com
03 Sep 2002 15:52:23 +0200
--=-THyM10Hm8X+Mfe9OrbdU
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable
Hi,
The following patch fixes a crash in mono when invoking
Delegate.Createdelegate(Type,object,string) with a wrong method name
string. Also, I think this is what the docs say that should be done.
The doc that I used is:
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/cpref/ht=
ml/frlrfsystemdelegateclasscreatedelegatetopic2.asp
Greetings,
Ricardo
--=20
Ricardo Fern=E1ndez Pascual
ric@users.sourceforge.net
Murcia. Espa=F1a.
--=-THyM10Hm8X+Mfe9OrbdU
Content-Description:
Content-Disposition: inline; filename=Delegate.cs.diff
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-15
Index: class/corlib/System/Delegate.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mono/mcs/class/corlib/System/Delegate.cs,v
retrieving revision 1.19
diff -u -r1.19 Delegate.cs
--- class/corlib/System/Delegate.cs 19 Aug 2002 13:27:58 -0000 1.19
+++ class/corlib/System/Delegate.cs 3 Sep 2002 13:47:47 -0000
@@ -98,6 +98,11 @@
=20
BindingFlags flags =3D BindingFlags.Public | BindingFlags.Instance;
MethodInfo info =3D target.GetType ().GetMethod (method, flags);
+ =09
+ if (info =3D=3D null)
+ throw new ArgumentException=20
+ (Locale.GetText ("method string is not an instance method name"));
+
return CreateDelegate_internal (type, target, info);
}
=20
--=-THyM10Hm8X+Mfe9OrbdU--