Failed to load design-time assemblies

8 posts, 0 answers
  1. Hillin
    Hillin avatar
    21 posts
    Member since:
    Sep 2018

    Posted 17 Sep 2018 Link to this post

    Hi,

    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:

    There was an exception when loading the design time assembly 'C:\Users\hilli\AppData\Local\Microsoft\VisualStudio\15.0_80ebba97\Designer\ShadowCache\je5ud1s4.q21\k2t5rzgz.a2b\Design\Telerik.Windows.Controls.VisualStudio.Design.4.0.dll':
    Exception has been thrown by the target of an invocation.
    There was an exception when loading the design time assembly 'C:\Users\hilli\AppData\Local\Microsoft\VisualStudio\15.0_80ebba97\Designer\ShadowCache\je5ud1s4.q21\k2t5rzgz.a2b\Design\Telerik.Windows.Controls.Design.5.0.dll':
    Exception has been thrown by the target of an invocation.
    There was an exception when loading the design time assembly 'C:\Users\hilli\AppData\Local\Microsoft\VisualStudio\15.0_80ebba97\Designer\ShadowCache\5jhvf35f.d42\do1uq2qt.455\Design\Telerik.Windows.Controls.Input.Design.5.0.dll':
    Exception has been thrown by the target of an invocation.
    There was an exception when loading the design time assembly 'C:\Users\hilli\AppData\Local\Microsoft\VisualStudio\15.0_80ebba97\Designer\ShadowCache\5jhvf35f.d42\do1uq2qt.455\Design\Telerik.Windows.Controls.Input.VisualStudio.Design.4.0.dll':
    Exception has been thrown by the target of an invocation.
    There was an exception when loading the design time assembly 'C:\Users\hilli\AppData\Local\Microsoft\VisualStudio\15.0_80ebba97\Designer\ShadowCache\a05ikgih.c3x\jjr50u34.0ga\Design\Telerik.Windows.Controls.Navigation.Design.5.0.dll':
    Exception has been thrown by the target of an invocation.
    There was an exception when loading the design time assembly 'C:\Users\hilli\AppData\Local\Microsoft\VisualStudio\15.0_80ebba97\Designer\ShadowCache\a05ikgih.c3x\jjr50u34.0ga\Design\Telerik.Windows.Controls.Navigation.VisualStudio.Design.4.0.dll':
    Exception has been thrown by the target of an invocation.

     

    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.

  2. Hillin
    Hillin avatar
    21 posts
    Member since:
    Sep 2018

    Posted 03 Oct 2018 Link to this post

    Hi! Can somebody help me? This is really frustrating.
  3. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2425 posts

    Posted 04 Oct 2018 Link to this post

    Hello Hillin,

    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.
    1. 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.
    2. Remove all Telerik dlls from the project.
    3. Close all open .xaml tabs and then close the project.
    4. Clear the Visual Studio designer's shadow cache.
    5. Go to the project's folder and delete the "bin" and "obj" folders.
    6. Re-open the project and re-add the Telerik dlls.
    7. 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.

    Regards,
    Martin Ivanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  4. Hillin
    Hillin avatar
    21 posts
    Member since:
    Sep 2018

    Posted 28 Oct 2018 in reply to Martin Ivanov Link to this post

    Hi Martin,

    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.

  5. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2425 posts

    Posted 29 Oct 2018 Link to this post

    Hello Hillin,

    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.

    Regards,
    Martin Ivanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  6. Hillin
    Hillin avatar
    21 posts
    Member since:
    Sep 2018

    Posted 18 Apr 2019 Link to this post

    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?

  7. Hillin
    Hillin avatar
    21 posts
    Member since:
    Sep 2018

    Posted 18 Apr 2019 Link to this post

    Attaching a debugger to XDesProc.exe, several FileNotFoundExceptions can be caught:

    System.IO.FileNotFoundException: 'Could not load file or assembly 'Telerik.Windows.Core.Design, Version=2019.1.116.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The system cannot find the file specified.'

     

    Here is a full call stack:

    Telerik.Windows.Controls.Design.5.0.dll!Telerik.Windows.Controls.Design.MetadataRegistration.AddAttributes(Microsoft.Windows.Design.Metadata.AttributeTableBuilder builder)
    Telerik.Windows.Controls.Design.5.0.dll!Telerik.Windows.Controls.Design.Common.MetadataRegistrationBase.BuildAttributeTable()
    Telerik.Windows.Controls.Design.5.0.dll!Telerik.Windows.Controls.Design.Common.MetadataRegistrationBase.AttributeTable.get()
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.MetadataStore.AddAttributeTableProvider.AnonymousMethod__0()
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.MetadataStore.AddMutableMetadataSource(System.Type definingType, System.Func<Microsoft.Windows.Design.Metadata.AttributeTable> attributeTableCreator)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.MetadataStore.AddAttributeTableProvider(System.Type attributeTableProviderType, System.Action<System.Exception> onException)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.LoadAttributeTableProvidersFromDesignAssembly(System.Reflection.Assembly designAssembly, bool isOkToAddTracker)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.LoadAttributeTableProvidersFromDesignAssemblies(System.Collections.Generic.IEnumerable<System.Reflection.Assembly> designAssemblies)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.LoadAttributeTableProvidersFromDesignAssemblies()
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.EnsureDesignMetadataLoaded(bool showErrors)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.AssemblyCollection_EnumerationChanged(object sender, Microsoft.VisualStudio.DesignTools.Utility.Collections.EnumerationChangedEventArgs<Microsoft.VisualStudio.DesignTools.Designer.Metadata.AssemblyInformation> e)
    Microsoft.VisualStudio.DesignTools.Utility.dll!Microsoft.VisualStudio.DesignTools.Utility.Collections.NotifyingCollectionBase<System.__Canon>.EventInvoker(Microsoft.VisualStudio.DesignTools.Utility.Collections.EnumerationChangedEventArgs<System.__Canon> eventArguments)
    Microsoft.VisualStudio.DesignTools.Utility.dll!Microsoft.VisualStudio.DesignTools.Utility.Events.SuspendingEventManager<Microsoft.VisualStudio.DesignTools.Utility.Collections.EnumerationChangedEventArgs<Microsoft.VisualStudio.DesignTools.Designer.Metadata.AssemblyInformation>>.ForwardEvents()
    Microsoft.VisualStudio.DesignTools.Utility.dll!Microsoft.VisualStudio.DesignTools.Utility.Events.Suspender.SuspendDisposer.Dispose(bool disposing)
    Microsoft.VisualStudio.DesignTools.Utility.dll!Microsoft.VisualStudio.DesignTools.Utility.Events.Suspender.SuspendDisposer.Dispose()
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.AssemblyNotificationHandler..ctor.AnonymousMethod__5_0()
    Microsoft.VisualStudio.DesignTools.Utility.dll!Microsoft.VisualStudio.DesignTools.Utility.Events.Suspender.SuspendDisposer.Dispose(bool disposing)
    Microsoft.VisualStudio.DesignTools.Utility.dll!Microsoft.VisualStudio.DesignTools.Utility.Events.Suspender.SuspendDisposer.Dispose()
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyResolver.Initialize()
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyService.GetProjectAssemblyResolver(Microsoft.VisualStudio.DesignTools.DesignerContract.IHostProject project)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Metadata.Assemblies.ProjectAssemblyService.CreatePlatformReferenceAssemblyResolver(Microsoft.VisualStudio.DesignTools.DesignerContract.IHostProject project)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.CreatePlatformReferenceAssemblyResolver(Microsoft.VisualStudio.DesignTools.DesignerContract.IHostProject project)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.GetProjectContext(Microsoft.VisualStudio.DesignTools.DesignerContract.IHostProject project, Microsoft.VisualStudio.DesignTools.Designer.IPlatform platform, bool create)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.FindApplicationProjectContext(Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.IProjectContext requestingContext)
    Microsoft.VisualStudio.DesignTools.XamlDesigner.dll!Microsoft.VisualStudio.DesignTools.XamlDesigner.Documents.XamlProjectContext.Application.get()
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Documents.SceneDocument.GetApplicationDocument(Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.IProjectContext activeContext)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Views.ViewRootResolver.OpenView(Microsoft.VisualStudio.DesignTools.Designer.Documents.SceneDocument document, bool hidden, bool initalize)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.Views.ViewRootResolver.GetView(Microsoft.VisualStudio.DesignTools.Markup.DocumentModel.IDocumentRoot documentRoot, bool hidden)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.DocumentViewContext.CreateAndOpenViewInternal(Microsoft.VisualStudio.DesignTools.Designer.Documents.SceneDocument document, System.Threading.CancellationToken cancelToken, bool activate, bool ensureOpenInHost)
    Microsoft.VisualStudio.DesignTools.Designer.dll!Microsoft.VisualStudio.DesignTools.Designer.DesignerService.CreateDesigner(Microsoft.VisualStudio.DesignTools.DesignerContract.IHostSourceItem item, Microsoft.VisualStudio.DesignTools.DesignerContract.IHostTextEditor editor, System.Threading.CancellationToken cancelToken)
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteDesignerService.CreateDesigner.AnonymousMethod__0(System.Threading.CancellationToken cancelToken)
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteDesignerService.MarshalInWithCancellation.AnonymousMethod__0()
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.Invoke(bool waitingInExternalCall)
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.InvokeCall(Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call call)
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.ProcessQueue(Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.CallQueue queue)
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.ProcessInboundQueue(int identity)
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.ProcessMessage(int msg, System.IntPtr wParam, System.IntPtr lParam, bool elevatedQuery, ref bool handled)
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.OnWindowMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)
    Microsoft.VisualStudio.DesignTools.DesignerContract.dll!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.MessageOnlyHwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)
    [Native to Managed Transition]
    [Managed to Native Transition]
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame)
    PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore)
    PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)
    PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window)
    XDesProc.exe!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.RunApplication()
    XDesProc.exe!Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.Main.AnonymousMethod__0()
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state)
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()
  8. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2425 posts

    Posted 22 Apr 2019 Link to this post

    Hello Hillin,

    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.

    Regards,
    Martin Ivanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top