Saturday, January 03, 2009

Slowly moving forwards - chart issue of the day

I've just spent some time debugging our server which went to 100% busy.

It turned out to be caused by this line in our code:
        Chart1.Height = new Unit(chartCount * 250.0, UnitType.Pixel);

This went to zero when chartCount was zero... and somewhere in the chart code (presumably somewhere in the layout code?) this zero height caused an infinite loop.

Moral of the story - if you don't want infinite loop busy thread 100% CPU when using Microsoft Chart Control, then don't set the chart height to zero!

Fixed code was:
        Chart1.Height = new Unit(chartCount * 250.0 + 1.0, UnitType.Pixel);

No comments:

Post a Comment