From 272a2cd18c5ff361c9139d8fb3b3b2882edf9d99 Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Tue, 9 Nov 2010 15:41:01 +0900 Subject: [PATCH] Fix generic XamlTypeName output and GetType() to get some xml reader case working. --- mcs/class/System.Xaml/System.Xaml.Schema/XamlTypeName.cs | 7 +++---- mcs/class/System.Xaml/System.Xaml/XamlLanguage.cs | 2 +- .../System.Xaml/Test/System.Xaml.Schema/XamlTypeNameTest.cs | 9 ++++++--- mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs | 2 -- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mcs/class/System.Xaml/System.Xaml.Schema/XamlTypeName.cs b/mcs/class/System.Xaml/System.Xaml.Schema/XamlTypeName.cs index 137c03eb7d6..36cf2f1aca6 100644 --- a/mcs/class/System.Xaml/System.Xaml.Schema/XamlTypeName.cs +++ b/mcs/class/System.Xaml/System.Xaml.Schema/XamlTypeName.cs @@ -140,11 +140,13 @@ namespace System.Xaml.Schema public XamlTypeName () { + TypeArguments = empty_type_args; } static readonly XamlTypeName [] empty_type_args = new XamlTypeName [0]; public XamlTypeName (XamlType xamlType) + : this () { if (xamlType == null) throw new ArgumentNullException ("xamlType"); @@ -155,8 +157,6 @@ namespace System.Xaml.Schema l.AddRange (from x in xamlType.TypeArguments.AsQueryable () select new XamlTypeName (x)); TypeArguments = l; } - else - TypeArguments = empty_type_args; } public XamlTypeName (string xamlNamespace, string name) @@ -165,6 +165,7 @@ namespace System.Xaml.Schema } public XamlTypeName (string xamlNamespace, string name, IEnumerable typeArguments) + : this () { Namespace = xamlNamespace; Name = name; @@ -175,8 +176,6 @@ namespace System.Xaml.Schema l.AddRange (typeArguments); TypeArguments = l; } - else - TypeArguments = empty_type_args; } public string Name { get; set; } diff --git a/mcs/class/System.Xaml/System.Xaml/XamlLanguage.cs b/mcs/class/System.Xaml/System.Xaml/XamlLanguage.cs index 6b55c0f3431..5f909335dff 100755 --- a/mcs/class/System.Xaml/System.Xaml/XamlLanguage.cs +++ b/mcs/class/System.Xaml/System.Xaml/XamlLanguage.cs @@ -275,7 +275,7 @@ namespace System.Xaml return null; Type [] genArgs = null; - if (typeArguments != null) { + if (typeArguments != null && typeArguments.Count > 0) { var xtns = typeArguments; genArgs = new Type [xtns.Count]; for (int i = 0; i < genArgs.Length; i++) { diff --git a/mcs/class/System.Xaml/Test/System.Xaml.Schema/XamlTypeNameTest.cs b/mcs/class/System.Xaml/Test/System.Xaml.Schema/XamlTypeNameTest.cs index 6a7d3ff7a82..920226f87d1 100644 --- a/mcs/class/System.Xaml/Test/System.Xaml.Schema/XamlTypeNameTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml.Schema/XamlTypeNameTest.cs @@ -38,7 +38,8 @@ namespace MonoTests.System.Xaml.Schema [Test] public void ConstructorDefault () { - new XamlTypeName (); + var xtn = new XamlTypeName (); + Assert.IsNotNull (xtn.TypeArguments, "#1"); } [Test] @@ -52,14 +53,16 @@ namespace MonoTests.System.Xaml.Schema public void ConstructorNameNull () { // allowed. - new XamlTypeName ("urn:foo", null); + var xtn = new XamlTypeName ("urn:foo", null); + Assert.IsNotNull (xtn.TypeArguments, "#1"); } [Test] public void ConstructorNamespaceNull () { // allowed. - new XamlTypeName (null, "FooBar"); + var xtn = new XamlTypeName (null, "FooBar"); + Assert.IsNotNull (xtn.TypeArguments, "#1"); } [Test] diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs index 20f6f8a6a68..03e6e3ab833 100755 --- a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs @@ -130,7 +130,6 @@ namespace MonoTests.System.Xaml } [Test] - [Category ("NotWorking")] public void Read_DictionaryInt32String () { ReadTest ("Dictionary_Int32_String.xml"); @@ -138,7 +137,6 @@ namespace MonoTests.System.Xaml } [Test] - [Category ("NotWorking")] public void Read_DictionaryStringType () { ReadTest ("Dictionary_String_Type.xml"); -- 2.11.4.GIT