Can not host Richtextbox

3 posts, 1 answers
  1. Dietmar
    Dietmar avatar
    4 posts
    Member since:
    Dec 2017

    Posted 08 Jul Link to this post

    Hi,

     

    if I'm trying to host your control, I will get an error that the component "Telerik.Windows.Documents.UI.Adorner.ImageAdornerUI" has no resource which could be identified by URI "/Telerik.Windows.Documents;component/ui/adorner/imageadornerui.xaml".

    If I run it anyway, this result will be shown:

    System.IO.FileNotFoundException
      HResult=0x80070002
      Nachricht = Die Datei oder Assembly "Microsoft.Windows.Design.Extensibility, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
      Quelle = mscorlib
      Stapelüberwachung:
       bei System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
       bei System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
       bei System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
       bei System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
       bei System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
       bei System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
       bei System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
       bei Microsoft.Internal.AttributeServices.GetAttributes[T](ICustomAttributeProvider attributeProvider)
       bei Microsoft.Internal.AttributeServices.GetFirstAttribute[T](ICustomAttributeProvider attributeProvider)
       bei System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
       bei System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator()
       bei System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
       bei System.ComponentModel.Composition.Primitives.ComposablePartCatalog.GetExports(ImportDefinition definition)
       bei System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.CatalogExportProvider.InnerCatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
       bei System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
       bei System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
       bei System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
       bei System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
       bei System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.ImportEngine.TryGetExports(ExportProvider provider, ComposablePart part, ImportDefinition definition, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportSubset(PartManager partManager, IEnumerable`1 imports, AtomicComposition atomicComposition)
       bei System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportsStateMachine(PartManager partManager, ComposablePart part)
       bei System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImports(PartManager partManager, ComposablePart part, Boolean shouldTrackImports)
       bei System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImportsOnce(ComposablePart part)
       bei System.ComponentModel.Composition.Hosting.CompositionContainer.SatisfyImportsOnce(ComposablePart part)
       bei Telerik.Windows.Documents.UI.Extensibility.RadCompositionInitializer.SatisfyImports(Object part)
       bei Telerik.Windows.Documents.UI.Extensibility.UIExtensibilityManager.GetLayersBuilder()
       bei Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.OnOwnerChanged()
       bei Telerik.Windows.Documents.UI.DocumentPresenterBase.set_Owner(RadRichTextBox value)
       bei Telerik.Windows.Controls.RadRichTextBox.InitActiveEditorPresenter(Boolean clearTextRelatedObjectPools)
       bei Telerik.Windows.Controls.RadRichTextBox.OnApplyTemplate()
       bei System.Windows.FrameworkElement.ApplyTemplate()
       bei System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       bei System.Windows.UIElement.Measure(Size availableSize)
       bei System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       bei System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       bei System.Windows.UIElement.Measure(Size availableSize)
       bei MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       bei System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       bei System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       bei System.Windows.UIElement.Measure(Size availableSize)
       bei System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
       bei System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       bei System.Windows.UIElement.Measure(Size availableSize)
       bei System.Windows.Controls.Border.MeasureOverride(Size constraint)
       bei System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       bei System.Windows.UIElement.Measure(Size availableSize)
       bei System.Windows.Window.MeasureOverrideHelper(Size constraint)
       bei System.Windows.Window.MeasureOverride(Size availableSize)
       bei System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       bei System.Windows.UIElement.Measure(Size availableSize)
       bei System.Windows.Interop.HwndSource.SetLayoutSize()
       bei System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       bei System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
       bei System.Windows.Window.SetRootVisual()
       bei System.Windows.Window.SetRootVisualAndUpdateSTC()
       bei System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
       bei System.Windows.Window.CreateSourceWindow(Boolean duringShow)
       bei System.Windows.Window.CreateSourceWindowDuringShow()
       bei System.Windows.Window.SafeCreateWindowDuringShow()
       bei System.Windows.Window.ShowHelper(Object booleanBox)
       bei System.Windows.Window.Show()
       bei System.Windows.Window.ShowDialog()
       bei InstructionsPlugin.ViewModel.InstructionsPluginViewModel.AddNewEntryAction(Object args) in C:\Users\Didi\Documents\Visual Studio 2015\Projects\Leitstand\InstructionsPlugin\ViewModel\InstructionsPluginViewModel.cs: Zeile147
       bei InstructionsPlugin.ViewModel.InstructionsPluginViewModel.<.ctor>b__16_0(Object c) in C:\Users\Didi\Documents\Visual Studio 2015\Projects\Leitstand\InstructionsPlugin\ViewModel\InstructionsPluginViewModel.cs: Zeile89
       bei GUICore.Commands.DelegateCommand.Execute(Object parameter) in C:\Users\Didi\Documents\Visual Studio 2015\Projects\Leitstand\GUICore\Commands\DelegateCommand.cs: Zeile41
       bei MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
       bei System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
       bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       bei System.Windows.Threading.DispatcherOperation.InvokeImpl()
       bei System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       bei MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
       bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       bei MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
       bei System.Windows.Threading.DispatcherOperation.Invoke()
       bei System.Windows.Threading.Dispatcher.ProcessQueue()
       bei System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       bei System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       bei System.Windows.Application.RunDispatcher(Object ignore)
       bei System.Windows.Application.RunInternal(Window window)
       bei System.Windows.Application.Run(Window window)
       bei System.Windows.Application.Run()
       bei ServiceController.App.Main()

     

    What I then did, is creating a new empty project and copied your sample which works.

    If I copy that back I will get the exceptions.

    I use R3 2017.

     

    Any ideas?

     

    best regards

    Dietmar

     

     

  2. Answer
    Boby
    Admin
    Boby avatar
    684 posts

    Posted 11 Jul Link to this post

    Hello Dietmar,

    Do you mean that you are getting the 'imageadornerui.xaml'-related error in design-time (when displaying the windows of the project in the Visual Studio designer)? We had some reports from customers about this, but more often the design-time error disappears when the code is build or the Visual Studio instance is restarted. If you have sample project which consistently reproduces it, could you send it to us for further investigation? If needed, you can open a support ticket where you can attach zip files in private.

    For the second problem, it's seems related to the fact that RadRichTextBox uses MEF under the covers to load extensible UI components. By default, all assemblies in the base application directory (i.e. around the .exe file) are loaded in search for implementors of specific interfaces (e.g. IFindReplaceDialog). From the call stack, it seems that MEF is trying to load Microsoft.Windows.Design.Extensibility, and fails to find one of its dependencies. As a workaround, you can either remove the mentioned assembly from the base application directory, or, in case it's indeed needed, set custom MEF catalog including the needed types, as described in MEF-Explicitly set the necessary types
     help article, e.g.:
    RadCompositionInitializer.Catalog = new TypeCatalog(
    // format providers
    typeof(XamlFormatProvider),
    typeof(RtfFormatProvider),
    typeof(DocxFormatProvider),
    typeof(PdfFormatProvider),
    typeof(HtmlFormatProvider),
    typeof(TxtFormatProvider),
     
    // mini toolbars
    typeof(SelectionMiniToolBar),
    typeof(ImageMiniToolBar),
     
    // context menu
    typeof(ContextMenu),
     
    // the default English spellchecking dictionary
    typeof(RadEn_USDictionary),
     
    // dialogs
    typeof(AddNewBibliographicSourceDialog),
    typeof(ChangeEditingPermissionsDialog),
    typeof(EditCustomDictionaryDialog),
    typeof(FindReplaceDialog),
    typeof(FloatingBlockPropertiesDialog),
    typeof(FontPropertiesDialog),
    typeof(ImageEditorDialog),
    typeof(InsertCaptionDialog),
    typeof(InsertCrossReferenceWindow),
    typeof(InsertDateTimeDialog),
    typeof(InsertTableDialog),
    typeof(InsertTableOfContentsDialog),
    typeof(ManageBibliographicSourcesDialog),
    typeof(ManageBookmarksDialog),
    typeof(ManageStylesDialog),
    typeof(NotesDialog),
    typeof(ProtectDocumentDialog),
    typeof(RadInsertHyperlinkDialog),
    typeof(RadInsertSymbolDialog),
    typeof(RadParagraphPropertiesDialog),
    typeof(SetNumberingValueDialog),
    typeof(SpellCheckingDialog),
    typeof(StyleFormattingPropertiesDialog),
    typeof(TableBordersDialog),
    typeof(TablePropertiesDialog),
    typeof(TabStopsPropertiesDialog),
    typeof(UnprotectDocumentDialog),
    typeof(WatermarkSettingsDialog));

    Let us know if you have additional questions.

    Regards,
    Boby
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Dietmar
    Dietmar avatar
    4 posts
    Member since:
    Dec 2017

    Posted 16 Jul in reply to Boby Link to this post

    Hi Boby,

    thank you for your answer.



    First problem:

    You are right, it seems to be a design time error. I thought it has something to do with my second problem.

    My project has a lot of dependencies. So extracting it to a standalone application isn't that easy.

    I will do this in the next day's and provide it to you.



    Second problem:

    I indeed use/need MEF and the workaround you provided works fine. Thank you!



    Best regards

    Dietmar
Back to Top