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
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.