I inherited a legacy application that now has to run on Windows 10. During testing, we found that part of the program (which is a child window placed as a toolbar) would only partially draw when the program starts--more than half of the right of the toolbar would draw only black. At runtime, the fix was to resize the whole window, which would resize/redraw the toolbar window. We eventually found that if we set "Disable display scaling" appeared to prevent the bug entirely (tested to a confidence of just beyond 1-in-10,000 so far, which is good enough for me).
The question is:
this bug only occurred with a probability likely between 1/12 and 1/20 (which I determined from video of our automatic tests of the program, which involved 185 opportunities for the bug to occur. No pattern of occurrence has been discerned). I've never had to deal with a bug like this, and so I'm wondering: given the bug's apparent randomness, and the fix, what was happening? A race condition between the bitmap rendering that Windows then upscales for "high DPI" and the functions that lay out the toolbar?