[A]Telerik.Windows.Controls.RadWatermarkTextBox cannot be cast to [B]Telerik.Windows.Controls.RadWatermarkTextBox

1 Answer 129 Views
WatermarkTextBox
Marco
Top achievements
Rank 1
Iron
Iron
Iron
Marco asked on 11 Aug 2021, 06:14 AM

I recently updated Telerik for WPF to the latest version. Since then I have following problem:

When I work with the designer I get this error:

[A]Telerik.Windows.Controls.RadWatermarkTextBox cannot be cast to [B]Telerik.Windows.Controls.RadWatermarkTextBox. Type A originates from 'Telerik.Windows.Controls, Version=2021.2.615.45, Culture=neutral, PublicKeyToken=...' in the context 'LoadFrom' at location 'C:\Program Files (x86)\Progress\Telerik UI for WPF R2 2021\Binaries\WPF45\Telerik.Windows.Controls.dll'. Type B originates from 'Telerik.Windows.Controls, Version=2021.2.615.45, Culture=neutral, PublicKeyToken=....' in the context 'LoadNeither' at location 'C:\Users\user\AppData\Local\Microsoft\VisualStudio\16.0_589b9641\Designer\ShadowCache\sc041jsc.3tf\nxls5byu.o3i\Telerik.Windows.Controls.dll'.

This only occurs on UserControls I want to insert somewhere. So I can use the RadWatermarkTextBox normally. But if it's in a UserControl this error is thrown.

How can I resolve this errror?


1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 13 Aug 2021, 10:05 AM

Hello Marco,

Such an error can occur if two separate Telerik UI for WPF installations are present on the same machine and both of them are referenced by the same project.

As the error suggests, the RadWatermarkTextBox class is located in two locations. It appears that some caching is taking place and you can try deleting the C:\Users\user\AppData\Local\Microsoft\VisualStudio\16.0_589b9641\Designer\ShadowCache\sc041jsc.3tf\nxls5byu.o3i folder to resolve this error. Please make sure to close Visual Studio before doing so.

If this does not resolve the error, please also try using the ReferencesResolver extension to point all references targeting Telerik assemblies to the same location.

Alternatively, you can try installing the NuGet packages as explained in this article.

Please let me know if any of these approaches solves your issue. I will be looking forward to your reply.

Regards,
Dilyan Traykov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Marco
Top achievements
Rank 1
Iron
Iron
Iron
commented on 13 Aug 2021, 11:06 AM

I tried to delete the folder in the appdata. It doesn't help.

So I installed the ReferenceResolver. No refereneces were resolved.

Then I saw that I have installed 6 diffrent telerik Versions (C:\Program Files (x86)\Progress). This happend over the years. I deleted all Versions and tried again. And this was the solution.

Thank you Dilyan for your help. 

Dilyan Traykov
Telerik team
commented on 13 Aug 2021, 11:19 AM

I'm happy to hear that you've managed to resolve the error. Also, thank you for sharing your solution with our community.
Tags
WatermarkTextBox
Asked by
Marco
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dilyan Traykov
Telerik team
Share this question
or