WPF Xaml editor Problem Loading

Ribbon for WPF Forum

Posted 9 years ago by ZS
Version: 9.2.0511
Avatar
Hello.

In my project I am using your Actipro WPF controls and also Telerik WPF controls.
In this situation VS Xaml editor show me error Problem Loading:

Error 2 The type initializer for 'ActiproSoftware.Windows.Controls.Ribbon.RibbonWindow' threw an exception. Error at object 'System.Windows.Setter' in markup file 'ActiproSoftware.Ribbon.Wpf30;v9.2.511.0;component/Themes/Ribbon/Common/RibbonWindow.xaml'.

If I remove Telerik WPF controls from References then Xaml editor work and show OK.

How Can I resolve that ?

Thanks for your answer.
Regards,

Comments (5)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
First you need to figure out what the real exception is here. You need to catch the exception and dig all the way down to its innermost exception. That will tell you exactly what the problem is.

Since you say it is due to Telerik controls being included in the project, it's probably related to their stuff and not ours though.


Actipro Software Support

Posted 9 years ago by ZS
Avatar
Hello.

Larger Error Details:

The type initializer for 'ActiproSoftware.Windows.Controls.Ribbon.RibbonWindow' threw an exception.  Error at object 'System.Windows.Setter' in markup file 'ActiproSoftware.Ribbon.Wpf30;v9.2.511.0;component/Themes/Ribbon/Common/RibbonWindow.xaml'.
   at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
   at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
   at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
   at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
   at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
   at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
   at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
   at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
   at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
   at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
   at System.Windows.Markup.TreeBuilder.Parse()
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at System.Windows.SystemResources.ResourceDictionaries.LoadDictionary(Assembly assembly, String assemblyName, String resourceName, Boolean isTraceEnabled)
   at System.Windows.SystemResources.ResourceDictionaries.LoadThemedDictionary(Boolean isTraceEnabled)
   at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
   at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
   at System.Windows.FrameworkElement.FindResourceInternal(FrameworkElement fe, FrameworkContentElement fce, DependencyProperty dp, Object resourceKey, Object unlinkedParent, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, DependencyObject boundaryElement, Boolean isImplicitStyleLookup, Object& source)
   at System.Windows.StyleHelper.GetChildValueHelper(UncommonField`1 dataField, ItemStructList`1& valueLookupList, DependencyProperty dp, DependencyObject container, FrameworkObject child, Int32 childIndex, Boolean styleLookup, EffectiveValueEntry& entry, ValueLookupType& sourceType, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.GetChildValue(UncommonField`1 dataField, DependencyObject container, Int32 childIndex, FrameworkObject child, DependencyProperty dp, FrugalStructList`1& childRecordFromChildIndex, EffectiveValueEntry& entry, ValueLookupType& sourceType, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.GetValueFromTemplatedParent(DependencyObject container, Int32 childIndex, FrameworkObject child, DependencyProperty dp, FrugalStructList`1& childRecordFromChildIndex, FrameworkElementFactory templateRoot, EffectiveValueEntry& entry)
   at System.Windows.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.LoadOptimizedTemplateContent(DependencyObject container, ParserContext parserContext, OptimizedTemplateContent optimizedTemplateContent, FrameworkTemplate frameworkTemplate, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at MS.Internal.WindowControl.DesignTimeWindow.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Designer.SimpleViewManager.DesignerBackground.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
   at Microsoft.Windows.Design.Interaction.DesignerView.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Designer.Viewport.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Interop.HwndSource.SetLayoutSize()
   at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
   at MS.Internal.Designer.VSIsolatedDesigner.ViewHolder.Initialize()
   at MS.Internal.Designer.VSIsolatedDesigner.ViewHolder..ctor(UIElement content)
   at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.get_ViewHandle()
   at MS.Internal.Host.Isolation.IsolatedView.get_ViewHandle()
   at MS.Internal.Designer.DesignerPane.LoadDesignerView()

 
The type initializer for 'ActiproSoftware.Windows.Controls.Ribbon.RibbonWindow' threw an exception.
   at System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(IntPtr type)
   at System.Windows.DependencyProperty.FromName(String name, Type ownerType)
   at System.Windows.Markup.BamlMapTable.GetDependencyPropertyValueFromId(Int16 memberId, String memberName, Type& declaringType)
   at System.Windows.Markup.BamlRecordReader.GetCustomDependencyPropertyValue(BamlPropertyCustomRecord bamlPropertyRecord, Type& declaringType)
   at System.Windows.Markup.BamlRecordReader.GetCustomDependencyPropertyValue(BamlPropertyCustomRecord bamlPropertyRecord)
   at System.Windows.Markup.StyleBamlRecordReader.ReadPropertyCustomRecord(BamlPropertyCustomRecord bamlPropertyRecord)
   at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)

 
The type initializer for 'ActiproSoftware.Windows.Themes.ThemeManager' threw an exception.
   at ActiproSoftware.Products.Shared.Design.CommonMetadata.a(AttributeCallbackBuilder A_0)
   at MS.Internal.Metadata.MutableAttributeTable.ExpandAttributes(Type type, AttributeList attributes)
   at MS.Internal.Metadata.MutableAttributeTable.<>c__DisplayClass2.<GetCustomAttributes>b__1(Type typeToGet, Object callbackParam)
   at MS.Internal.Metadata.MutableAttributeTable.GetExpandedAttributes(Type type, Object callbackParam, GetAttributesCallback callback)
   at MS.Internal.Metadata.MutableAttributeTable.GetCustomAttributes(Type ownerType, String memberName)
   at Microsoft.Windows.Design.Metadata.AttributeTable.GetCustomAttributes(Type ownerType, String memberName)
   at MS.Internal.Metadata.AttributeDataCache.<GetMetadataStoreAttributes>d__0.MoveNext()
   at Microsoft.Windows.Design.Metadata.MetadataStore.MetadataType.<MergeAttributesIterator>d__0.MoveNext()
   at Microsoft.Windows.Design.Metadata.MetadataStore.MetadataType.MergeAttributes(Type filterType, MemberInfo member, Boolean inherit, AttributeMergeCache& cache)
   at Microsoft.Windows.Design.Metadata.MetadataStore.MetadataType.MetadataMethodInfo.GetCustomAttributes(Type attributeType, Boolean inherit)
   at MS.Internal.ComponentModel.AttachInfo.get_Attributes()
   at MS.Internal.ComponentModel.AttachInfo.CanAttach(DependencyObject instance)
   at MS.Internal.ComponentModel.APCustomTypeDescriptor.GetProperties(Attribute[] attributes)
   at MS.Internal.ComponentModel.APCustomTypeDescriptor.GetProperties()
   at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultExtendedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
   at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes)
   at System.ComponentModel.TypeDescriptor.GetProperties(Object component)
   at MS.Internal.Model.PropertyUpdater.GetRedirectedProperty(DependencyObject redirection, PropertyDescriptor descriptor)
   at MS.Internal.Model.PropertyUpdater.GetPropertyValue(ModelPropertyImpl property)
   at Microsoft.Windows.Design.Documents.Trees.ModelDocumentTreeManager.ModelPropertyMapperImpl.GetValue(ModelPropertyImpl property)
   at MS.Internal.Model.ModelPropertyImpl.get_Value()
   at MS.Internal.Model.ModelPropertyImpl.get_IsDictionary()
   at MS.Internal.DocumentTrees.Model.ModelDocumentItem.BeginReadingProperties(Identity identity, IValueSerializerContext context)
   at MS.Internal.DocumentTrees.Instance.InstanceItemBase.Populate(DocumentItem item, FeatureManager featureManager, Boolean cloned)

 
Could not load type 'Microsoft.Windows.Design.Metadata.ProvideMetadataAttribute' from assembly 'Microsoft.Windows.Design.Extensibility, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType)
   at System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit)
   at ActiproSoftware.Windows.Themes.ThemeManager.a(Assembly A_0)
   at ActiproSoftware.Windows.Themes.ThemeManager..cctor()
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Are you able to break on this exception and try and see what the the Assembly value is being passed to the ThemeManager.a method on the second last line of your stack trace?

All we're doing there is calling Microsoft's Assembly.GetCustomAttributes method on loaded assemblies. My guess is that the Telerik ones are doing something that makes that Microsoft code blow up. So I'd like to have you see which Assembly is being passed there to see if it is in fact a Telerik assembly.

Also what is the innermost exception type. We could put a try...catch around this call to handle this in future builds but need to know the innermost exception type (for the "Could not load type 'Microsoft.Windows.Design.Metadata.ProvideMetadataAttribute'..." message).


Actipro Software Support

Posted 9 years ago by ZS
Avatar
Hello.

With new Actipro version 2009.2 build 0512 and Telerik XAML controls Q3 2009 SP2 this problem are disappear and Xaml Editor work normally.

Thanks for your response.
Regards,

[Modified at 01/18/2010 02:14 PM]
Posted 9 years ago by Umesh Bhavsar
Avatar
Hi,
I had similar problem.
Check your registry for following:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\Windows Presentation Foundation]
@="WPF v3.0.6920.1453"
"Version"="3.0.6920.1453"
"WPFReferenceAssembliesPathx86"="C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\v3.0\\"
"WPFCommonAssembliesPathx86"="C:\\Windows\\System32\\"
"InstallRoot"="C:\\Windows\\Microsoft.NET\\Framework\\v3.0\\WPF\\"
"InstallSuccess"=dword:00000001
"ProductVersion"="3.0.6920.1453"
"WPFNonReferenceAssembliesPathx86"="C:\\Windows\\Microsoft.NET\\Framework\\v3.0\\WPF\\"

If this key is absent at the specified location, copy whole text and save in a file. Import the file in your registry.

Positively, will solve your problem.

Hope it helps.

Regards,

Umesh Bhavsar
The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.