2010-04-22 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 22 Apr 2010 12:13:16 +0000 (12:13 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 22 Apr 2010 12:13:16 +0000 (12:13 -0000)
* XamlMemberInvoker.cs : make sure GetValue() is not supported
  on directives.

* XamlMemberInvokerTest.cs : make sure GetValue() is not supported
  on directives.

svn path=/trunk/mcs/; revision=155946

mcs/class/System.Xaml/System.Xaml.Schema/ChangeLog
mcs/class/System.Xaml/System.Xaml.Schema/XamlMemberInvoker.cs
mcs/class/System.Xaml/Test/System.Xaml.Schema/ChangeLog
mcs/class/System.Xaml/Test/System.Xaml.Schema/XamlMemberInvokerTest.cs

index c91ac0aac7d528ccd4155d8a8a93601d1f78e06d..1d56e1203c5389315dfa460f718e26c606f10f87 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-22  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XamlMemberInvoker.cs : make sure GetValue() is not supported
+         on directives.
+
 2010-04-14  Atsushi Enomoto  <atsushi@ximian.com>
 
        * XamlTypeTypeConverter.cs : this prefers UnderlyingType.ToString()
index e4acd7285f06b98b8a00a813f1d176b954bcc2fc..729567927c98f66ba4d4b2ded5b640604e8f7edf 100644 (file)
@@ -57,6 +57,8 @@ namespace System.Xaml.Schema
                {
                        if (instance == null)
                                throw new ArgumentNullException ("instance");
+                       if (this is XamlDirective)
+                               throw new NotSupportedException ("not supported operation on directive members.");
                        if (UnderlyingGetter == null)
                                throw new NotSupportedException ("Attempt to get value from write-only property or event");
                        return UnderlyingGetter.Invoke (instance, new object [0]);
@@ -65,6 +67,8 @@ namespace System.Xaml.Schema
                {
                        if (instance == null)
                                throw new ArgumentNullException ("instance");
+                       if (this is XamlDirective)
+                               throw new NotSupportedException ("not supported operation on directive members.");
                        if (UnderlyingSetter == null)
                                throw new NotSupportedException ("Attempt to get value from read-only property");
                        UnderlyingSetter.Invoke (instance, new object [] {value});
index 7be9ecd5cd112afda07b3e3f10c5beaf1a001f11..df73ea280b869b93b436f8c731cc5577d53f55f1 100755 (executable)
@@ -1,3 +1,8 @@
+2010-04-22  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * XamlMemberInvokerTest.cs : make sure GetValue() is not supported
+         on directives.
+
 2010-04-22  Atsushi Enomoto  <atsushi@ximian.com>
 
        * XamlMemberInvokerTest.cs : make sure that the invoker returns Type
index d37de1506cdc84282cde43d9dabd4ed99b0f083b..093309b3e5c41afe5e8651d6d16ec7d44ad7bb30 100644 (file)
@@ -125,6 +125,24 @@ namespace MonoTests.System.Xaml.Schema
                        Assert.AreEqual (typeof (int), o, "#1");
                }
 
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void GetValueInitialization ()
+               {
+                       var xm = XamlLanguage.Initialization;
+                       var i = xm.Invoker;
+                       i.GetValue ("foo");
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void GetValuePositionalParameter ()
+               {
+                       var xm = XamlLanguage.PositionalParameters;
+                       var i = xm.Invoker;
+                       i.GetValue (new TypeExtension (typeof (int)));
+               }
+
                [Test]
                [ExpectedException (typeof (TargetException))]
                public void SetValueOnIrrelevantObject ()