Recurring Actipro exception in VS 2010 editor

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 10 years ago by jsharp
Version: 13.2.0592
Avatar

I am rather new to Actipro and XAML, though I've been doing similar work for a long time.  I am developing a spin-off of an existing product and don't know where to look to correct a frequently recurring exception I get in the VS 2010 editor.  I can "reload" (sometimes a couple time) and then it looks right in the editor for a few minutes, then the exception occurs again.  I am able to edit the XAML directly and the compiled application works as I intended.  This is just a development environment issue.

I can't send the whole project, but if someone can decode this down to something like "look at your ____ controls" or some such, that would go a long way.  The exceptions below are copied directly from what I see in the design window.  Thanks in advance for any help!

System.ArgumentException
GenericArguments[0], 'ActiproSoftware.Windows.Themes.EditorsThemeCatalog', on 'ActiproSoftware.Windows.Themes.ThemeCatalogRegistrarBase'1[T]' violates the constraint of type 'T'.
at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
at System.RuntimeType.MakeGenericType(Type[] instantiation)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeType(Type type)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.TryGetRuntimeType()
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.EnsureRuntimeType(Type type)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider.GetRuntimeType(Type reflectionType)
at MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.VsReflectionResolver.GetRuntimeType(Type reflectionType)
at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.CachingReflectionResolver.GetRuntimeType(Type reflectionType)
at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.Microsoft.Windows.Design.Metadata.IReflectionResolver.GetRuntimeType(Type reflectionType)
at MS.Internal.Metadata.ClrType.get_RuntimeMember()
at MS.Internal.Metadata.ClrMember'1.Microsoft.Windows.Design.Metadata.Reflection.IReflectionMember.get_MemberInfo()
at MS.Internal.Metadata.ClrType.Equals(Object obj)
at System.Collections.Generic.ObjectEqualityComparer'1.Equals(T x, T y)
at System.Collections.Generic.Dictionary'2.FindEntry(TKey key)
at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.<>c__DisplayClass5.<FindAttachableProperties>b__4(ITypeMetadata walkType)
at MS.Internal.Design.Metadata.Xaml.XamlType.<GetAllAttachableProperties>d__7.MoveNext()
at MS.Internal.Design.Metadata.Xaml.XamlType.<FindAttachableProperties>d__0.MoveNext()
at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.<FindAttachableProperties>d__7.MoveNext()
at MS.Internal.VirtualModel.VirtualModelPropertyCollection.<GetUncachedProperties>d__0.MoveNext()
at System.Linq.Buffer'1..ctor(IEnumerable'1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable'1 source)
at MS.Internal.VirtualModel.VirtualModelPropertyCollection.GetEnumerator()
at MS.Internal.VirtualModel.VirtualModelUtilities.WrapProperties(IVirtualModelItem item)
at MS.Internal.VirtualModel.VirtualModelItem.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.MergedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes)
at System.Windows.PropertyPath.ResolvePropertyName(String name, Object item, Type ownerType, Object context, Boolean throwOnError)
at MS.Internal.Data.PropertyPathWorker.GetInfo(Int32 k, Object item, SourceValueState& svs)
at MS.Internal.Data.PropertyPathWorker.ReplaceItem(Int32 k, Object newO, Object parent)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.AttachDataItem()
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)
at System.Windows.Data.MultiBindingExpression.AttachBindingExpression(Int32 i, Boolean replaceExisting)
at System.Windows.Data.MultiBindingExpression.AttachOverride(DependencyObject d, DependencyProperty dp)
at System.Windows.Data.BindingExpressionBase.Attach(DependencyObject target, DependencyProperty dp)
at System.Windows.Data.BindingExpressionBase.OnAttach(DependencyObject d, DependencyProperty dp)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
at MS.Internal.GridControl.GridColumnAdornerBase..ctor(ModelItem gridItem, ModelItem columnItem)
at MS.Internal.GridControl.GridColumnSelectAdorner..ctor(ModelItem grid, ModelItem column)
at MS.Internal.GridControl.GridDesigner.EnsureColumnAdorners(ModelItem columnDefModel, Boolean withHandle)
at MS.Internal.GridControl.GridDesigner.EnsureAllColumnAdorners()
at MS.Internal.GridControl.GridDesigner.InitGridDesigner()
at MS.Internal.GridControl.GridDesigner.GetDesigner(ModelItem gridItem)
at MS.Internal.GridControl.AlwaysVisibleGridAdornerProvider.Activate(ModelItem item)
at Microsoft.Windows.Design.Interaction.AdornerProvider.InvokeActivate(EditingContext context, ModelItem item)
at MS.Internal.Features.AdornerProviderFeatureConnector.FeatureProvidersAdded(ModelItem item, IEnumerable'1 extensions)
at Microsoft.Windows.Design.Policies.PolicyDrivenFeatureConnector'1.UpdateFeatureProviders()
at MS.Internal.Features.PolicyDrivenToolFeatureConnector'1.UpdateCurrentTool(Tool newTool)
at MS.Internal.Features.PolicyDrivenToolFeatureConnector'1.<.ctor>b__0(Tool newTool)
at Microsoft.Windows.Design.ContextItemManager.SubscribeProxy'1.SubscribeContext(ContextItem item)
at Microsoft.Windows.Design.SubscribeContextCallback.Invoke(ContextItem item)
at Microsoft.Windows.Design.EditingContext.DefaultContextItemManager.OnItemChanged(ContextItem item)
at Microsoft.Windows.Design.EditingContext.DefaultContextItemManager.SetValue(ContextItem value)
at MS.Internal.Host.ToolSubsystem.ActivateTool(ToolFactory toolFactory)
at MS.Internal.Host.ToolSubsystem..ctor(EditingContext editingContext, DesignerContext designerContext)
at MS.Internal.Host.Designer.Load()
at MS.Internal.Designer.VSDesigner.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.Load()
at MS.Internal.Designer.DesignerPane.LoadDesignerView(Boolean isReload)

System.TypeLoadException
GenericArguments[0], 'ActiproSoftware.Windows.Themes.EditorsThemeCatalog', on 'ActiproSoftware.Windows.Themes.ThemeCatalogRegistrarBase'1[T]' violates the constraint of type parameter 'T'.
at System.RuntimeTypeHandle.Instantiate(RuntimeTypeHandle handle, IntPtr* pInst, Int32 numGenericArgs, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.Instantiate(Type[] inst)
at System.RuntimeType.MakeGenericType(Type[] instantiation)

Comments (3)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

This is very odd and seems like it is VS bug.  Basically we have a EditorsThemeCatalogRegistrar class that we effectively include in the Generic.xaml for the Editors control library.

That class is defined as such:

public class EditorsThemeCatalogRegistrar : ThemeCatalogRegistrarBase<EditorsThemeCatalog> { }

And ThemeCatalogRegistrarBase is defined as:

public abstract class ThemeCatalogRegistrarBase<T> : ResourceDictionary where T : ThemeCatalogBase, new() {

The exception you posted seems to be saying that EditorsThemeCatalog either doesn't inherit ThemeCatalogBase (which it does) or doesn't have a public parameterless constructor (which it also does).

I don't see how that exception could possibly happen unless VS is somehow confusing versions of the Editors and Shared libraries.  Perhaps VS is shadow copying one of the two assemblies for some reason meaning that perhaps it loads a second copy of the Editors.dll or something that doesn't properly get flagged that it is referencing the loaded Shared lib so the type inheritance change gets out of whack?  That's all I can think of that would ever cause something like that.

Since you said it generally works but happens after some time, that would sort of confirm that there is indeed some bug in VS causing this.  I can't think of anything we could do differently on our end since the code is properly set up.

Do you have the latest service packs for VS 2010?  Maybe it's something they have fixed.


Actipro Software Support

Posted 10 years ago by jsharp
Avatar

I went with the "confusing versions" and checked my references.  One Actipro reference (Actipro.Editors.Wpf.dll) in one project out of a couple dozen was at v.12.1.0562 while the rest were at v.13.1.0580.  The design editor is behaving now.  Thank you for providing the bread crumb I needed!

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Aha... super!  I'm glad that's all it was.


Actipro Software Support

The latest build of this product (v24.1.1) 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.