Ticket T296857
Visible to All Users

ImageCollection Referenced Assembly Image Cache not refreshed / Designer Error

created 9 years ago

Dear DevExpress Colleagues,

Here is a bug report / feature request with a sample project and screenshots of steps to reproduce the issue.
The problem is with using linked assembly with images as a repository for all images for ImageCollection component.

The documentation for ImageCollection makes an incorrect statement:
https://documentation.devexpress.com/#WindowsForms/clsDevExpressUtilsImageCollectiontopic

"Important: Visual Studio 2012 and higher caches the ImageCollection content. Thus, if you modify the collection (e.g. add a new image into it), you need to re-start Visual Studio in order to see your changes at design time."

In VS2013, restarting Visual Studio does not refresh the cache. However, there is another way to force that cache to be refreshed, which DevExpress already uses today but doesn't apply everywhere consistently.

Right now, we are forced to pretend we want to add images from Project Resources, then Cancel the popup, then retry adding From Referenced Assemblies in order to refresh the cache. This always works as long as there is at least one image in the Project Resources.

REQUEST 1: Please look at how the DLL cache gets refresh as a result of opening the Project Resources view and implement the same refresh at each opening of the popup for adding images From Referenced Assembly.

Use ImgLibCache project and review these steps:

Step01 - Review DLL imag elist (embedded content cache).png
Step02 - Add new image to collection.png
Step03 - Set Build Action to Embedded Resource.png
Step04 - Rebuild ImgLibrary DLL project.png
Step05 - Add from Ref Assemblies -- Confirm Cached Image list.png
Step06 - Add from Project Resources -- Open popup and Cancel.png
Step07 - Review cached DLL image list.png
Step08 - Add project resource file.png
Step09 - Add project resource file 2.png
Step10 - Add any image to resource file.png
Step11 - Add any image to resource file 2.png
Step12 - Rebuild main project.png
Step13 - Reconfirm DLL image list cache (add from ref assys).png
Step14 - Add from Project Resources (non-empty resource list).png
Step15 - Add from Ref Assemblies (cache refreshed).png

The 15 steps above demonstrate that simply doing "Add From Project Resources" and then "Add From Ref. Assemblies" does not help if project resources are non-existent. However, if there is at least one image in Project resources, you are already refreshing the cache.
We want to make it easier for developers and not force them to do all these extra clicks -- make DevExpress refresh the cache.

RELATED PROBLEM:

When we work with Microsoft Team Foundation Server, we run into a related issue with the image cache.
A developer adds a new image to the DLL and adds it to the main form in the solution in his own branch.
Then this developer merges the files that have been changed into the main branch.
That action only takes the new image file, the ImgLibrary CSPROJ file and the updated Form1 files (*.cs and *.Designer.cs).

Now when another developer opens Form1 in Designer in the main branch, they see an error message because the new image is referenced by the form but the cache isn't refreshed. No matter how many times you rebuild the solution, reopen Visual Studio, nothing helps.
The only thing that helps with this is to create another form or open another existing form in the same project as the one with the new image, add ImageCollection to it and then refresh the Cache by switching to Add From Project Resources and then to Add From Referenced Assemblies.
After the cache is refreshed, the original Form1 can be safely reopened in Designer without any problems.

You can observe the original solution in ImgLibCache sample project. ImgCacheLib2 shows how another developer would have added an extra button on the form with a new image in hiw own branch. ImgCacheLib3 sample project shows what a "merged" solution would look like when a new image file is added with an updated ImgLibrary CSPROJ with updated Form1 files.

Review screenshots:
TFS - Step 1 - Open Form1 in Designer after merging updates.png
TFS - Step 2 - Open Form1 in Designer after merging updates 2.png

REQUEST 2: Please add the ability to refresh the DLL image cache to the Rebuild Solution action.

This is an urgent request. Without these items, developers have to perform a lot of extra steps to refresh the cache.

Please update documentation, when this is fixed. Once again, simply reopening Visual Studio doesn't help.

Please confirm this issue does not exist in DevExpress 15.1.
We plan to upgrade to the new version soon.

Show previous comments (2)
KP KP
Konstantin Paradizov 9 years ago

    Hi Svetlana,
    Yes, I am able to refresh the cache properly if I rebuild the project before restarting Visual Studio. The catch here is the necessary rebuild action. This should probably be reflected in this statement in the Documentation page "Visual Studio 2012 and higher caches the ImageCollection content. Thus, if you modify the collection (e.g. add a new image into it), you need to re-start Visual Studio in order to see your changes at design time." It should mention the "rebuild".
    Having said that, the reason why this is a major annoyance for us is because we work with large systems with tens of thousands of lines of code. These solutions are source controlled. Reopening Visual Studio and coming back into Designer takes time for those projects.
    When you have a distributed team with developers with varying internet connection speeds, reopening large projects and dealing with source control takes even more time away.
    I think that since DevExpress already refreshes this cache, it may be something that can be reproduced to make the product even better. The Project Resources form that does this refreshing in Visual Studio 2013 (perhaps by accident) is shown in the attached video.
    Please pass this on to the developers. If I had your latest code, I would tell you which function causes the refresh. But debugging DevExpress library through PDB files as I did with my previous ticket is a bit tedious since not all sources always match up all PDBs and DLLs for internal code.

    KP KP
    Konstantin Paradizov 9 years ago

      Here is a video showing how to simulate the team development with 2 instances of Visual Studio.
      I have put the project into the Source Control repository for the sake of demonstration.
      This illustrates the problem when a developer gets an error in Designer if he/she did not Rebuild and Restart Visual Studio upon obtaining latest changes from source control.
      Please see attached video

      KP KP
      Konstantin Paradizov 9 years ago

        I realized I didn't respond to your comment about not updating DLL image library frequently.
        You are correct in that nobody plans to be updating this frequently in the beginning of the project. However, we have a huge application and we came to a point where we have started to refactor forms with more than 7000 lines of code. At that point we decided to assemble all frequently used images into a single DLL. That alone has reduced the complexity because those images are no longer base64 encoded in a resource file.
        As we hoped that the image library is mostly done, the scope creep came in and more requirements were added to the project. So now we have developers adding images. Moreover, I cannot even say that they will only add a couple and will be done with it. There may be more and more added. I don't know how frequently. It depends on requirements from the software.
        So we cannot hope that we will not have to deal with it. It would be better to be able to refresh that cache.
        I understand you guys figured it out for VS2010. But we have already passed that stage. Next we will be going only up in versions. VS2015 is next. I'm not sure how caching works there.
        I am thankful for everything your development team does.
        If they could figure out a way to make this better in a hotfix or in 15.1.xxx it would be great.
        Thank you

        Answers approved by DevExpress Support

        created 9 years ago

        Hi,

        We will certainly update our documentation to underline that it is necessary to re-build a project before closing it (Documentation - Add a note that it is necessary to re-build a project before you close it to the ImageCollection help article). As for your inquiry, I understand your idea to re-use the same mechanism that it is used when you invoke a dialog to select images from the project's resources. There is no necessity to debug our source code yourself. I have already passed this information to our developers. They will research this way. I have also informed them of the second case with TFS.

        If our developers find a way to introduce this feature, I will let you know.

          Comments (2)

            Hello Svetlana,

            any news on this issue?

            Thanks

            DevExpress Support Team 8 years ago

              We have not yet introduced a new mechanism of refreshing images. Once we implement this feature, we will add information about it on our What's New  page.

              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.