* XamlObjectReader.cs : check constructible type. Remove extra ns node.
* XamlObjectReaderTest.cs : enable working tests and remove invalid
comment.
svn path=/trunk/mcs/; revision=155681
+2010-04-18 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XamlObjectReader.cs : check constructible type. Remove extra ns node.
+
2010-04-18 Atsushi Enomoto <atsushi@ximian.com>
* XamlType.cs : ignore ReferenceConverter which is used for IList<T>.
if (!type.IsPublic)
throw new XamlObjectReaderException (String.Format ("instance type '{0}' must be public and non-nested.", type));
root_type = SchemaContext.GetXamlType (instance.GetType ());
+ if (root_type.ConstructionRequiresArguments && root_type.TypeConverter == null)
+ throw new XamlObjectReaderException (String.Format ("instance type '{0}' has no default constructor.", type));
}
else
root_type = XamlLanguage.Null;
var rootNS = root_type.PreferredXamlNamespace;
if (rootNS != XamlLanguage.Xaml2006Namespace)
tmp_ns_decls.Add (new NamespaceDeclaration (rootNS, String.Empty));
- tmp_ns_decls.Add (new NamespaceDeclaration (XamlLanguage.Xaml2006Namespace, "x"));
+ else
+ tmp_ns_decls.Add (new NamespaceDeclaration (XamlLanguage.Xaml2006Namespace, "x"));
namespaces = new NSList (XamlNodeType.StartObject, tmp_ns_decls.ToArray ()).GetEnumerator ();
tmp_ns_decls.Clear ();
+2010-04-18 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XamlObjectReaderTest.cs : enable working tests and remove invalid
+ comment.
+
2010-04-18 Atsushi Enomoto <atsushi@ximian.com>
* XamlObjectReaderTest.cs : add simple read tests for some types.
[Test]
[ExpectedException (typeof (XamlObjectReaderException))]
- [Category ("NotWorking")]
public void ReadNonConstructible ()
{
- var r = new XamlObjectReader (XamlLanguage.String);
// XamlType has no default constructor.
- r.Read ();
+ var r = new XamlObjectReader (XamlLanguage.String);
}
[Test]
}
[Test]
- // WTF, It does not give XAML namespace, but XamlSerives.Save()
- // serializes DateTime instance in the XAML namespace.
- [Category ("NotWorking")]
public void Read_DateTime ()
{
var obj = new DateTime (2010, 4, 15);