Bug Report T295535
Visible to All Users

ImageCollection throws an exception (HRESULT: 0x80131047) on adding images From Referenced Assemblies at design time

created 9 years ago

Dear DevExpress Colleagues,

I am attaching a bug report to you complete with a sample project and screenshots to replicate the issue.
I have done the legwork for you and debugged DevExpress code because I needed a solution to my problem fast.

It appears that ImageCollection option to add images "From Referenced Assemblies" uses unsafe code to get a list of those assemblies from the project. This is witnessed in this ticket.

The problem arises from having added Windows Media Player to a form through customization of the Toolbox as previously advised by experts on the web. When you customize the toolbox and pick Windows Media Player from COM Objects tab, Visual Studio will create an ActiveX wrapper to do that.

As a result, the project will have references to system DLLs. See references (AxWMPLib and WMPLib) in sample project.

When you invoke "From Referenced Assemblies" functionality it attempts to obtain all DLLs and look inside them.
That functionality chokes on looking inside Windows Media Player because of how it's linked.

The user sees the error message:
"Error invoking 'From Referenced Assemblies'. Details: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)".

If you attach a debugger to this Visual Studio Designer session, with DevExpress PDB files and full sources, the debugger will stop in Tools.cs:
static Assembly DoLoadDefaultAssembly(string assemblyName) {
      return Assembly.Load(assemblyName);
}

This method does not appear to have try / catch clause around the Assembly.Load call.
One of the assemblyName items that comes in here is for Windows Media Player and it contains a GUID with additional information attached ending with "aximp". That blows everything up.

To see the full picture I went up a step in call stack and set a break point in SolutionImagePickerForm.cs in DoLoadAssembly(Reference reference).
Then I was able to continue execution and repeat the process causing an error, which brought me here again and let me see the assemblyName and a simple FileNotFound problem that is somehow uncaught.
When I attached sources from DevExpress 14.2.4, which is what I have installed, Visual Studio complained in SolutionImagePickerForm saying the source is not from the same version… and I see a try/catch in DoLoadAssembly…

I hope you can check that the latest version of DevExpress (15.1) doesn't have this issue.
We are hoping to upgrade soon.
I think the fix is relatively simple if you put try/catch right there in DoLoadDefaultAssembly in Tools.cs.

Right now, as a workaround we've had to go without using Windows Media Player in our application.

Thank you,
Konstantin

Comments (1)
DevExpress Support Team 9 years ago

    Hello Konstantin,
    I have reproduced this behavior and forwarded this ticket to our developers for further research. We will update this ticket when we get results.

    Answers approved by DevExpress Support

    created 9 years ago

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

      Comments (2)
      KP KP
      Konstantin Paradizov 9 years ago

        Hi,
        There is a new ticket on a related issue with ImageCollection DLL image cache. It would be great to have both fixes in the same hotfix if possible. Thank you.
        https://www.devexpress.com/Support/Center/Question/Details/T296857

        Nadezhda (DevExpress Support) 9 years ago

          Hello Konstantin,

          The ImageCollection Referenced Assembly Image Cache not refreshed / Designer Error ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.