none
TargetInvocationException when creating an Icon from Resources RRS feed

  • Question

  • After recent update of Windows we started to experience a very annoying problem. In one of our applications we can't get past a very simple statement of

    dialog.Icon = global::ViewerApp.Properties.Resources._32_icon_graph;

    where _32_icon_graph is an icon contained in resources.

    This happens in VS2008 in both debug and release modes. When this line is hit the TargetInvocationException error is thrown with inner error being
    {"Not enough storage is available to process this command"} of type System.ComponentModel.Win32Exception.

    The exception it shrown by statement ResourceManager.GetObject() when attempting to create an icon:

       at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
       at System.Drawing.Icon..ctor(SerializationInfo info, StreamingContext context)

    Further facts:

    1. No single line of code changed before error started to appear
    2. Other resources (non-icon) are read without problems
    3. Changing icons in resources did not help
    4. -case a) User is logged to its own account: Error happens regardless of user being or not being member of Administrators group or if VS2008 is run as Administrator
    5. -case b) User is logged to Administrator account: Error DOES NOT happen if user logs in as Administrator and launches VS2008 or if VS2008 is run under user account (non-admin)
    6. I've just reinstalled the system (Windows XP SP3) and installed all updates
    7. Before applying updates (some 53 that are reported as High Priority after SP3 installation) all works fine

    Has anyone experienced similar problem? Is there a solution to it?

    Thanks,

    Krystian

    Monday, November 16, 2009 1:26 PM

Answers