GDI+ Error in System.Drawing.Graphics.MeasureString

11 posts, 0 answers
  1. Sudi
    Sudi avatar
    1 posts
    Member since:
    Oct 2014

    Posted 27 Oct 2014 Link to this post

    My application populates a combobox with 3000+ items. When I select all the items in the list, I get the following error on postback of the page.

    Is there a limit on the maximum number of items/characters I can display in the combobox?

    [ExternalException (0x80004005): A generic error occurred in GDI+.]
    System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat) +1593640
    System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea) +18
    System.Drawing.Graphics.MeasureString(String text, Font font) +43
    Telerik.Web.UI.RadComboBox.MeasureCheckedItemsText(String checkedItemsTexts) +188
    Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) +421
    System.Web.UI.Control.PreRenderRecursiveInternal() +113
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Control.PreRenderRecursiveInternal() +222
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297


  2. Sudi
    Sudi avatar
    1 posts
    Member since:
    Oct 2014

    Posted 27 Oct 2014 Link to this post

    Some more information around this issue...
    1. The number of items being bound to the control = 9100
    2. The max length of items in the control = 116
    3. The total number of characters rendered in the box (9100 * length of each item) = 630,021
    4. There are no spikes in the number of GDI Objects (both client & server side) when I monitored through Windows Task Manager. 

    Any help will be much appreciated.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 30 Oct 2014 Link to this post

    Hello Sudi,

    I have tested the described scenario and everything is working fine. Please test the attached project and try to modify it in order to reproduce the problem.

    Regards,
    Peter Filipov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Rimon Erez
    Rimon Erez avatar
    1 posts
    Member since:
    Jan 2009

    Posted 30 Oct 2014 in reply to Peter Filipov Link to this post

    Hi Peter,

    We modified your project to handle the exact data that our application binds to the dropdown. Unfortunately, we can't replicate the error this way. 

    Are there any other reasons why the control could be exceeding the max GDI+ handles limit?
  6. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 31 Oct 2014 Link to this post

    Hello Rimon,

    We are not aware of such issue, that's why I have requested for a modification on the sample. Pleas let me know if you find out how to reproduce it. 

    Regards,
    Peter Filipov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Vivek
    Vivek avatar
    3 posts
    Member since:
    Apr 2015

    Posted 01 Apr 2015 Link to this post

    Hello All,

    I am also getting the below error on my application page where Stored Procedure is returning around 3500 records.

    System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.   
    at System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat)    
    at System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea)    
    at System.Drawing.Graphics.MeasureString(String text, Font font)    
    at Telerik.Web.UI.RadComboBox.MeasureCheckedItemsText(String checkedItemsTexts)    
    at Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e)    
    at System.Web.UI.Control.PreRenderRecursiveInternal()    
    at System.Web.UI.Control.PreRenderRecursiveInternal()   
    at System.Web.UI.Control.PreRenderRecursiveInternal()    
    at System.Web.UI.Control.PreRenderRecursiveInternal()    
    at System.Web.UI.Control.PreRenderRecursiveInternal() 

    But if I am altering the stored Proc to return top 3000 records it's working fine.

    Could anyone please help me on this?

    Regards,
    Vivek
  8. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 03 Apr 2015 Link to this post

    Hi Vivek,

    Could you test your project with Q1.2015. The measuring algorithm of the checked items is changed and that issue should not appear.

    Regards,
    Peter Filipov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  9. Vivek
    Vivek avatar
    3 posts
    Member since:
    Apr 2015

    Posted 07 Apr 2015 in reply to Peter Filipov Link to this post

    Hi Peter,

    Thanks for the update...

    Could you please let me know from where I can download the Telerik.Web.UI.dll for Q1.2015 and also could you please let me know if updating this will impact the existing UI?

    Regards,

    Vivek

  10. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 07 Apr 2015 Link to this post

    Hello Vivek,

    You need to log into your profile and download it from there(look for SP Q1 2015). There should be no major differences in the appearance.

    Regards,
    Peter Filipov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  11. Vivek
    Vivek avatar
    3 posts
    Member since:
    Apr 2015

    Posted 07 Apr 2015 in reply to Peter Filipov Link to this post

    Thanks Peter...

     One more query before proceeding with download of SP Q1 2015 that currently we are using the Telerik.Web.UI.dll with attached details so there will be no impact and no major changes if i will upgrade this from Q1 2015.

     

    Regards,

    Vivek

  12. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 08 Apr 2015 Link to this post

    Hi Videk,

    In the ticket info it is pointed that your are using Q3 2014. That's why I have suggested you to update. 
    For case it is 4 years difference and we have done many improvements and bug fixes in our code, so it is possible to have some differences in your app which must be repaired. My suggestion is to update as soon as you could and try to stick to the latest versions of our product in order to avoid big migrations as this in the future. The benefit will be visible since we are trying to improve out products to keep the count of the bugs to minimum.

    Regards,
    Peter Filipov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017