Discussion: should we throw ANEs or do nothing in `UITypeEditor.PaintValue subclasses`
See original GitHub issueE.g. in ColorEditor:
/// <summary>
/// Paints a representative value of the given object to the provided canvas.
/// Painting should be done within the boundaries of the provided rectangle.
/// </summary>
public override void PaintValue(PaintValueEventArgs e)
{
if (e.Value is Color color)
{
SolidBrush b = new SolidBrush(color);
e.Graphics.FillRectangle(b, e.Bounds);
b.Dispose();
}
}
Currently this is a NRE for Paint(null). However, do we want to throw an ANE or nop if the event args are null.
Looking at the construction of this code, I’m inclined to be a nop, as we’re checking explicitly whether the event args that were passed to us were invalid
Let me know - I’d like to send in a PR
Current Cases
- ColorEditor: throws NRE
- FontNameEditor: throws NRE
- ImageEditor: nop
- ImageListEditor: throws NRE
- UITypeEditor (and other subclasses that do nothing in
PaintValue): nop
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think they have all been refactored to make the null argument a no-op.
We would like these to be
nopin these cases. Thanks!