I just recently fixed a bug in Paint.NET where I had inadvertently overridden the OnScroll() method instead of the OnShown() method. The code I added was meant to raise the priority of the UI thread while a dialog was initializing (in its constructor), and then drop the priority back to normal once the dialog was finally visible (in OnShown()). This was shown to improve the snappiness of Paint.NET’s UI because it does a lot of processing in background threads, which was then competing with dialog initialization and initial rendering. Since the reversion code was in OnScroll(), which never gets called, the reversion simply never happens. If I’d done a more careful code review, I probably would have caught this.

The reason it was in OnScroll() is because I typed “override OnS” and then expected Visual Studio to auto-complete the method signature. It did this correctly, but I had already overridden OnShown() and so the next match was OnScroll(). Luckily in this case there was no major negative consequence.

About these ads