My UI for WPF (2018 R1) used to work very well, but some days ago the design-time components stopped working. All the Rad controls lost their styles in the designer; however in run time they work just fine.
When Visual Studio (2017, v15.8.4) launches, it shows the following messages in the General output channel:
I tried every method I can find on the web with a related topic, including but not limited to deleting obj and bin folders, cleaning and rebuilding, reinstalling Telerik UI for WPF and Visual Studio etc. etc..
I tracked these exceptions down with Fusion Log Viewer, and it seems they are trying to load assemblies named Telerik.Windows.Data and Telerik.Windows.Core.Design, which unfortunately are not found by Visual Studio (however they do exist in the installation and the lib folder under my solution).
I tried to copy all the telerik.*.dll files to C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\common7\ide\ in order to let Visual Studio to find them, this successfully eliminated the error messages in the General output channel, however all the Rad controls now become invisible in the designer.
I think this issue started when I changed all the projects in my solution to target x64 CPU instead of Any CPU, but I'm not sure because the problem still exists when I switch them back to Any CPU.
7 Answers, 1 is accepted
The errors probably come from the Visual Studio designer's cache. I would recommend you to try the following steps in order to resolve the issue.
- Change the project's target to AnyCPU or x86. Note that there is a limitation in the Visual Studio's designer when using x64 architecture. You can check the comment of the following bug report for more information on this.
- Remove all Telerik dlls from the project.
- Close all open .xaml tabs and then close the project.
- Clear the Visual Studio designer's shadow cache.
- Go to the project's folder and delete the "bin" and "obj" folders.
- Re-open the project and re-add the Telerik dlls.
- Clean, and Rebuild the project
This should clear all cached files. Also, you can take a peek at the Missing Controls in the UI article. I hope this helps.
Thanks for the help! I was working on another project, so sorry for the late reply.
The issue is indeed about the platform target. The project has to be AnyCPU or x86 in order to allow the designer to load the telerik dlls correctly. However, switching the platform target of the project itself is not enough; all projects/assemblies the project referenced must be AnyCPU/x86 too. This is the real PITA here.
Hope this can help any others who also run into this problem.
No worries for the late reply. And thank you for sharing the additional information on the issue. I am sure this will be helpful for anybody else too.
This problem happened again when I upgraded to VS2019 and Telerik WPF 2019 R1. The general output channel complained about similar design time assembly load failures. The designer does not work properly (does not render telerik controls in their styles).
The projects was kept targeting to Any CPU since last time the problem was resolved, so I reckon it is not the cause this time. They worked just fine before the upgrade.
I uninstalled VS2017 and Telerik WPF 2018 R1 before installing VS2019 and Telerik WPF 2019 R1.
Following your 7 steps of clearing ShadowCache does not resolve this problem.
If I remove all the telerik DLLs from the project, and use the Convert to Telerik Project feature in the extension, the designer can work for a while, but soon stops working.
Oddly enough, when I create a new WPF project and convert it to a Telerik project, it works without any problem. But since it is a huge project we are facing, it's unlikely we can strip it down to find the cause.
Could you give me some insight on how to fix/debug this kind of problem?
Attaching a debugger to XDesProc.exe, several FileNotFoundExceptions can be caught:
Here is a full call stack:
Can you please make sure that all the Telerik dlls are referenced from the same location on the file system. Some odd designer errors might appear if there are third party dlls referenced from different folders. For example, if you add Telerik.Windows.Controls.dll from one dir and Telerik.Windows.Controls.Navigation from another one.
Also, ensure that the directory from where you reference the Telerik dlls contains the "design" folder which is usually placed in the "Binaries\WPF" folder when you download the Telerik dlls. There you have the additional design-time logic. Note the you don't need to reference the design dlls manually. Visual Studio automatically takes care of this if the design folder is placed in the other dlls directory.