Author: benm
Date: 2005-05-07 11:24:06 -0400 (Sat, 07 May 2005)
New Revision: 44199
Added:
trunk/mcs/class/corlib/Test/System.Reflection/EventInfoTest.cs
Modified:
trunk/mcs/class/corlib/System.Reflection/ChangeLog
trunk/mcs/class/corlib/System.Reflection/MonoEvent.cs
trunk/mcs/class/corlib/Test/System.Reflection/ChangeLog
trunk/mcs/class/corlib/corlib_test.dll.sources
Log:
In Test/System.Reflection:
2005-05-07 Ben Maurer <[EMAIL PROTECTED]>
* EventInfoTest.cs: New file. Has a test case for #64191.
In System.Reflection:
2005-05-07 Ben Maurer <[EMAIL PROTECTED]>
* MonoEvent.cs (Get*Method): Handle nonPublic. Fixes #64191.
Modified: trunk/mcs/class/corlib/System.Reflection/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/ChangeLog 2005-05-07 10:27:44 UTC
(rev 44198)
+++ trunk/mcs/class/corlib/System.Reflection/ChangeLog 2005-05-07 15:24:06 UTC
(rev 44199)
@@ -1,3 +1,7 @@
+2005-05-07 Ben Maurer <[EMAIL PROTECTED]>
+
+ * MonoEvent.cs (Get*Method): Handle nonPublic. Fixes #64191.
+
2005-05-06 Zoltan Varga <[EMAIL PROTECTED]>
* Module.cs: Update for beta 2.
Modified: trunk/mcs/class/corlib/System.Reflection/MonoEvent.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/MonoEvent.cs 2005-05-07
10:27:44 UTC (rev 44198)
+++ trunk/mcs/class/corlib/System.Reflection/MonoEvent.cs 2005-05-07
15:24:06 UTC (rev 44199)
@@ -67,22 +67,29 @@
public override MethodInfo GetAddMethod(bool nonPublic) {
MonoEventInfo info;
MonoEventInfo.get_event_info (this, out info);
-
- return info.add_method;
+
+
+ if (nonPublic || (info.add_method != null &&
info.add_method.IsPublic))
+ return info.add_method;
+ return null;
}
public override MethodInfo GetRaiseMethod( bool nonPublic) {
MonoEventInfo info;
MonoEventInfo.get_event_info (this, out info);
- return info.raise_method;
+ if (nonPublic || (info.raise_method != null &&
info.raise_method.IsPublic))
+ return info.raise_method;
+ return null;
}
public override MethodInfo GetRemoveMethod( bool nonPublic) {
MonoEventInfo info;
MonoEventInfo.get_event_info (this, out info);
-
- return info.remove_method;
+
+ if (nonPublic || (info.remove_method != null &&
info.remove_method.IsPublic))
+ return info.remove_method;
+ return null;
}
#if NET_2_0
Property changes on: trunk/mcs/class/corlib/System.Reflection/MonoEvent.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/mcs/class/corlib/Test/System.Reflection/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Reflection/ChangeLog 2005-05-07
10:27:44 UTC (rev 44198)
+++ trunk/mcs/class/corlib/Test/System.Reflection/ChangeLog 2005-05-07
15:24:06 UTC (rev 44199)
@@ -1,3 +1,7 @@
+2005-05-07 Ben Maurer <[EMAIL PROTECTED]>
+
+ * EventInfoTest.cs: New file. Has a test case for #64191.
+
2005-05-02 Sebastien Pouliot <[EMAIL PROTECTED]>
* AssemblyTest.cs, FieldInfoTest.cs, MethodInfoTest.cs: Disabled
Added: trunk/mcs/class/corlib/Test/System.Reflection/EventInfoTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Reflection/EventInfoTest.cs
2005-05-07 10:27:44 UTC (rev 44198)
+++ trunk/mcs/class/corlib/Test/System.Reflection/EventInfoTest.cs
2005-05-07 15:24:06 UTC (rev 44199)
@@ -0,0 +1,66 @@
+//
+// EventInfoTest
+//
+// Ben Maurer ([EMAIL PROTECTED])
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Threading;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Reflection {
+
+[TestFixture]
+public class EventInfoTest
+{
+ [Test]
+ public void TestGetXXXMethod ()
+ {
+ EventInfo priv = typeof (PrivateEvent).GetEvents
(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) [0];
+ EventInfo pub = typeof (PublicEvent).GetEvents
(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) [0];
+
+ Assert.IsNull (priv.GetAddMethod ());
+ Assert.IsNull (priv.GetRaiseMethod ());
+ Assert.IsNull (priv.GetRemoveMethod ());
+
+ Assert.IsNotNull (pub.GetAddMethod ());
+ Assert.IsNull (pub.GetRaiseMethod ());
+ Assert.IsNotNull (pub.GetRemoveMethod ());
+ }
+
+ public class PrivateEvent
+ {
+ private static event EventHandler x;
+ }
+
+ public class PublicEvent
+ {
+ public static event EventHandler x;
+ }
+}
+}
Property changes on:
trunk/mcs/class/corlib/Test/System.Reflection/EventInfoTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/mcs/class/corlib/corlib_test.dll.sources
===================================================================
--- trunk/mcs/class/corlib/corlib_test.dll.sources 2005-05-07 10:27:44 UTC
(rev 44198)
+++ trunk/mcs/class/corlib/corlib_test.dll.sources 2005-05-07 15:24:06 UTC
(rev 44199)
@@ -92,6 +92,7 @@
System.Reflection/AssemblyNameTest.cs
System.Reflection/AssemblyTest.cs
System.Reflection/BinderTests.cs
+System.Reflection/EventInfoTest.cs
System.Reflection/FieldInfoTest.cs
System.Reflection/MethodInfoTest.cs
System.Reflection/ParameterInfoTest.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches