Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 1bb768c

Browse files
author
Atsushi Kanamori
committed
Fix 79 System.Data.Common.Test failures on ILC
These tests were null-referencing inside a IsReadOnly property that looked up ReadOnlyAttributes in a collection and invoked it without null-checking the lookup result. The reason it's allowed to do that that is this collection has some magic in it that lazily auto-populates itself with the "default" value of the attribute if the attribute itself isn't found on a lookup. So as long a default exists, a lookup of this attribute type never returns null. Unfortunately, the "default" is discovered by reflecting for a static field named "Default" on the attribute type.
1 parent e27f72b commit 1bb768c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/System.ComponentModel.TypeConverter/src/Resources/System.ComponentModel.TypeConverter.rd.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,18 @@
1616
</Type>
1717
</Namespace>
1818
</Assembly>
19+
<Assembly Name="System.ComponentModel.Primitives">
20+
<Namespace Name="System.ComponentModel">
21+
<Type Name="ReadOnlyAttribute">
22+
<!-- ReadOnlyAttribute: need to be able to read the field named "Default" as System.ComponentModel.TypeConverter
23+
relies on AttributeCollection returning ReadOnlyAttribute.Default if none was placed in the collection.
24+
That lookup is done by Reflection.
25+
-->
26+
<Field Name="Default" Dynamic="Required Public">
27+
</Field>
28+
</Type>
29+
</Namespace>
30+
</Assembly>
1931
</Library>
2032
</Directives>
33+

0 commit comments

Comments
 (0)