[Mono-bugs] [Bug 82814][Blo] New - Cannot distinguish CustomAttribute values that are Types from Strings

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Sep 12 04:34:26 EDT 2007

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jeff.brown at gmail.com.


--- shadow/82814	2007-09-12 04:34:26.000000000 -0400
+++ shadow/82814.tmp.15627	2007-09-12 04:34:26.000000000 -0400
@@ -0,0 +1,55 @@
+Bug#: 82814
+Product: Mono: Class Libraries
+Version: 1.2
+OS Details: 
+Status: NEW   
+Priority: Blocker
+Component: Cecil
+AssignedTo: mono at evain.net                            
+ReportedBy: jeff.brown at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Cannot distinguish CustomAttribute values that are Types from Strings
+Description of Problem:
+It does not appear to be possible to distinguish CustomAttribute values
+that are Types from those that are Strings.  The metadata gets parsed from
+the original file correctly but when it is copied to the CustomAttribute
+object this information is lost.  From the perspective of the user, the
+attribute value is now just a string that happens to be a type name.
+Worse, I believe there will be problems with round-trip manipulation of
+assemblies with attributes that have object[] arrays containing Types.  In
+this case, the code in ReflectionWriter.CreateElem calls GetObjectTypeName
+to determine the type of each value.  That will fail for Type values
+because they're actually represented as strings by the reader right now.
+I think it would be best for the metadata reader to parse type names to
+TypeReference objects and store those in the CustomAttribute instead. 
+Likewise the metadata writer should check for the presence of TypeReference
+(and possible Type also) and do the right thing.
+Steps to reproduce the problem:
+1. Read in an assembly with an attribute value of type Type.
+Actual Results:
+The CustomAttribute object describing the attribute contains the type's
+name as a string in the constructor values, field values, or property
+values array, wherever it happened to be defined.
+Expected Results:
+It should pass the type as a TypeReference or something similarly unambiguous.
+How often does this happen? 

More information about the mono-bugs mailing list