Fix positional parameter argument output location check.
authorAtsushi Eno <atsushi@ximian.com>
Mon, 8 Nov 2010 11:35:12 +0000 (20:35 +0900)
committerAtsushi Eno <atsushi@ximian.com>
Mon, 8 Nov 2010 11:35:12 +0000 (20:35 +0900)
MarkupExtension with multiple arguments are prohibited at top level.

mcs/class/System.Xaml/System.Xaml/XamlXmlWriter-new.cs
mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs

index 6f6115b946c83154fd24a8b3d7d6646a1a0365ab..ebf6dcfde00fe7cdfe7d1faa6659581a512e5ff1 100755 (executable)
@@ -592,8 +592,6 @@ namespace System.Xaml
                        //  StartObject i.e. the root or a collection item.)
                        var posprms = member == XamlLanguage.PositionalParameters && IsAtTopLevelObject () && object_states.Peek ().Type.HasPositionalParameters () ? state.Type.GetSortedConstructorArguments ().GetEnumerator () : null;
                        if (posprms != null) {
-                               if (inside_toplevel_positional_parameter)
-                                       throw new XamlXmlWriterException (String.Format ("The XAML reader input has more than one positional parameter values within a top-level object {0}. While XamlObjectReader can read such an object, XamlXmlWriter cannot write such an object to XML.", state.Type));
                                posprms.MoveNext ();
                                var arg = posprms.Current;
                                w.WriteStartAttribute (arg.Name);
@@ -717,6 +715,9 @@ namespace System.Xaml
                                state.PositionalParameterIndex++;
                                break;
                        default:
+                               if (inside_toplevel_positional_parameter)
+                                       throw new XamlXmlWriterException (String.Format ("The XAML reader input has more than one positional parameter values within a top-level object {0} because it tries to write all of the argument values as an attribute value of the first argument. While XamlObjectReader can read such an object, XamlXmlWriter cannot write such an object to XML.", state.Type));
+
                                state.PositionalParameterIndex++;
                                w.WriteString (", ");
                                break;
index 29875053dffacf8000cbd2696fc77db761b5edfe..956b9bf960dcff786d76cfbe840ce2c2cc8c588c 100755 (executable)
@@ -768,7 +768,6 @@ namespace MonoTests.System.Xaml
 
                [Test]
                [ExpectedException (typeof (XamlXmlWriterException))]
-               [Category ("NotWorking")]
                public void Write_PositionalParameters1 ()
                {
                        // PositionalParameters can only be written when the