Remove DAM annotations from enum converter#100347
Conversation
|
Note regarding the |
|
Tagging subscribers to this area: @dotnet/area-system-componentmodel |
sbomer
left a comment
There was a problem hiding this comment.
LGTM but I'd appreciate if @MichalStrehovsky could take a look too.
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/EnumConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/EnumConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/EnumConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/EnumConverter.cs
Outdated
Show resolved
Hide resolved
...tem.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/EnumConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/EnumConverter.cs
Show resolved
Hide resolved
src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/EnumConverter.cs
Show resolved
Hide resolved
MichalStrehovsky
left a comment
There was a problem hiding this comment.
Looks good from trimming perspective. Can't talk about TypeConverter or why we accept System.Enum (and whether this should accept all non-enums for the same reasons it accepts System.Enum).
| public EnumConverter([DynamicallyAccessedMembers(TypeDescriptor.ReflectTypesDynamicallyAccessedMembers)] Type type) | ||
| public EnumConverter(Type type) | ||
| { | ||
| if (!type.IsEnum && !type.Equals(typeof(Enum))) |
There was a problem hiding this comment.
I'm a little bit concerned we have tests where this is used with a non-enum and it apparently works (System.Enum is really no different from just System.Object, or whatever).
* Remove DAM annotations from enum converter * expand the debug assert for enum types * FB * FB2
|
Seems there are a few others who might be broken by this: https://github.com/search?q=%2Fbase%5C%28type%5C.GetType%5C%28%5C%29%5C%29%2F+EnumConverter&type=code |
Remove DAM annotations from Enum converter since the trimmer always preserve
enums.