question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discussion: should we throw ANEs or do nothing in `UITypeEditor.PaintValue subclasses`

See original GitHub issue

E.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:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
elachlancommented, Jan 17, 2023

I think they have all been refactored to make the null argument a no-op.

1reaction
merriemcgawcommented, Jul 31, 2019

We would like these to be nop in these cases. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found