Invalid Image data - object is in use elsewhere

4 posts, 0 answers
  1. Anula
    Anula avatar
    1 posts
    Member since:
    Aug 2013

    Posted 30 May 2018 Link to this post

    Hello I have a following problem - in my web app I am using an html 5 report viewer with telerik reporting and from time to time I am encountering a following problem - picturebox control is not being loaded with image data. Attached is a screenshot with a problem.

    I am loading image data as base:

         [code]var bytes = Convert.FromBase64String(base64String);
                using (var ms = new MemoryStream(bytes))
                {
                    pbLogo.Value = Image.FromStream(ms);
                }[/code]

     

    I tried to search for similara problems, but none of the resolutions worked out.


  2. Squall
    Squall avatar
    181 posts
    Member since:
    Feb 2011

    Posted 01 Jun 2018 in reply to Anula Link to this post

    The error from this thread looks similar - https://social.msdn.microsoft.com/Forums/windows/en-US/2ee73705-d2a1-4f92-bda5-523fe1e4cd77/the-object-is-currently-in-use-elsewhere?forum=winforms

    Is this the same issue?

  3. Andrew
    Andrew avatar
    1 posts
    Member since:
    Aug 2017

    Posted 31 Jan in reply to Anula Link to this post

    Anula, did you ever find a solution for this problem?  I'm having the same issue.

    Thanks

  4. Silviya
    Admin
    Silviya avatar
    344 posts

    Posted 05 Feb Link to this post

    Hi Andrew,

    There's a lock inside GDI+ that prevents two threads from accessing a bitmap at the same time. Please check the following articles on the same topic:
    https://stackoverflow.com/questions/12355631/object-is-currently-in-use-elsewhere-exception-when-setting-image-in-picturebo
    https://stackoverflow.com/questions/1851292/invalidoperationexception-object-is-currently-in-use-elsewhere
    https://blogs.msmvps.com/peterritchie/2008/01/28/quot-object-is-currently-in-use-elsewhere-quot-error/

    Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top