Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@novell.com>2004-04-05 18:14:11 +0400
committerLluis Sanchez <lluis@novell.com>2004-04-05 18:14:11 +0400
commit2a724d4747a486f1ff9f5f2d91b1377d54942fd4 (patch)
tree99d30f8fbbb7e945b10bf84e645b5646fe2e83a1 /mcs/class/System/System.ComponentModel
parent77f8343505e62341f1dc8782e3abfbf258ca0d0a (diff)
* AttributeCollection.cs: Don't try to create a default attribute if the
attribute type does not have a default constructor. Fix by Jon Wagner. This fixes #53898. svn path=/trunk/mcs/; revision=25038
Diffstat (limited to 'mcs/class/System/System.ComponentModel')
-rw-r--r--mcs/class/System/System.ComponentModel/AttributeCollection.cs6
-rw-r--r--mcs/class/System/System.ComponentModel/ChangeLog6
2 files changed, 10 insertions, 2 deletions
diff --git a/mcs/class/System/System.ComponentModel/AttributeCollection.cs b/mcs/class/System/System.ComponentModel/AttributeCollection.cs
index 9412d1966e5..d683ae82655 100644
--- a/mcs/class/System/System.ComponentModel/AttributeCollection.cs
+++ b/mcs/class/System/System.ComponentModel/AttributeCollection.cs
@@ -73,12 +73,14 @@ namespace System.ComponentModel
protected Attribute GetDefaultAttribute (Type attributeType)
{
- Attribute attr;
+ Attribute attr = null;
BindingFlags bf = BindingFlags.Public | BindingFlags.Static;
FieldInfo def = attributeType.GetField ("Default", bf);
if (def == null) {
- attr = Activator.CreateInstance (attributeType) as Attribute;
+ ConstructorInfo constructorInfo = attributeType.GetConstructor (Type.EmptyTypes);
+ if (constructorInfo != null)
+ attr = constructorInfo.Invoke (null) as Attribute;
if (attr != null && !attr.IsDefaultAttribute ())
attr = null;
} else {
diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog
index c1266aca375..17f240cf5a4 100644
--- a/mcs/class/System/System.ComponentModel/ChangeLog
+++ b/mcs/class/System/System.ComponentModel/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-05 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * AttributeCollection.cs: Don't try to create a default attribute if the
+ attribute type does not have a default constructor. Fix by Jon Wagner.
+ This fixes #53898.
+
2004-03-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Win32Exception.cs: added ERROR_PATH_NOT_FOUND that reports the same