Quantcast
Channel: Developer Express Inc.
Viewing all articles
Browse latest Browse all 2370

WinForms issue with Windows 10, version 1803

$
0
0

One of our customers has reported to us a issue with our WinForms controls, one that is related to a GDI resource leak. In their case, it caused an application crash – their system has a limit on how many GDI objects can be allocated.

Upon investigation by the team it turns out that the leak is related to Windows 10 version 1803 (also known as the Windows 10 April 2018 Update), or later.

We devised a really simple test to reproduce the issue:

private void button1_Click(object sender, EventArgs e) {
  for(int x = 0; x < 100; x++) {
    using(var f = new Form() { ShowInTaskbar = false }) {
      f.Show();
    }
  }
}

This particular nasty piece of code – I don’t advise you use it in production! – will “leak” 300 GDI objects, since each form created with ShowInTaskbar = false will leak 3 GDI objects. It’s a very common scenario to have such an option turned on (all popups, tooltips, menus, drag-n-drops, alerts, etc. are examples of such forms), and if the application has a relatively complex UI and is run continuously, sooner or later it will crash or freeze.

We have already devised a workaround for this issue. Needless to say, some rigorous testing is currently being done to make sure we don’t break anything else. We shall be updating our WinForms components from v17.1 or later to include it.

We are contacting Microsoft to see if they aware of the issue, and trying to determine if they have any timeframe for a proper fix.


Viewing all articles
Browse latest Browse all 2370

Trending Articles