Browse Source

2003-07-16 Gonzalo Paniagua Javier <[email protected]>

	* TypeDescriptor.cs: fixed GetConverter (type) for enumerations that
	have a TypeConverter. Fixes bug #46397.

svn path=/trunk/mcs/; revision=16281
Gonzalo Paniagua Javier 22 years ago
parent
commit
dcbb8f79d0

+ 5 - 0
mcs/class/System/System.ComponentModel/ChangeLog

@@ -1,3 +1,8 @@
+2003-07-16  Gonzalo Paniagua Javier <[email protected]>
+
+	* TypeDescriptor.cs: fixed GetConverter (type) for enumerations that
+	have a TypeConverter. Fixes bug #46397.
+
 2003-07-14 Jerome Laban <[email protected]>
 
 	* IComponent.cs: Removed duplicate Designer attribute.

+ 6 - 3
mcs/class/System/System.ComponentModel/TypeDescriptor.cs

@@ -209,9 +209,6 @@ public sealed class TypeDescriptor
 	public static TypeConverter GetConverter (Type type)
 	{
 		Type t = DefaultConverters [type] as Type;
-		if (t == null && type.IsEnum)
-			t = (Type) DefaultConverters [typeof (Enum)];
-
 		string converter_name = null;
 		if (t == null) {
 			object [] attrs = type.GetCustomAttributes (false);
@@ -222,6 +219,12 @@ public sealed class TypeDescriptor
 					break;
 				}
 			}
+
+			if (converter_name == null && type.IsEnum) {
+				t = (Type) DefaultConverters [typeof (Enum)];
+				converter_name = t.FullName;
+			}
+
 		} else {
 			converter_name = t.FullName;
 		}