WPF Designer : System.ArgumentNullException

1.7k Views Asked by At

First of all, sorry for my bad english. I post here because I know some people have very relevant answers.

I've been working on a WPF application for several months without any problem. Since this morning, everytime I try to click, update or resize an element in the designer, an exception occurs and I must reload the designer every 10s.

This is kind of annoying and I really can't figure out how to resolve this.

Here is the error :

System.ArgumentNullException
La valeur ne peut pas être null.
   à System.RuntimeType.MakeGenericType(Type[] instantiation)
   à Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeType(Type type)
   à Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.TryGetRuntimeType()
   à Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.EnsureRuntimeType(Type type)
   à Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider.GetRuntimeType(Type reflectionType)
   à MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.VsReflectionResolver.GetRuntimeType(Type reflectionType)
   à Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.CachingReflectionResolver.GetRuntimeType(Type reflectionType)
   à Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.Microsoft.Windows.Design.Metadata.IReflectionResolver.GetRuntimeType(Type reflectionType)
   à MS.Internal.Metadata.ClrType.get_RuntimeMember()
   à MS.Internal.Metadata.ClrMember`1.Microsoft.Windows.Design.Metadata.Reflection.IReflectionMember.get_MemberInfo()
   à MS.Internal.Metadata.ClrType.Equals(Object obj)
   à System.Collections.Generic.ObjectEqualityComparer`1.Equals(T x, T y)
   à System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   à System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
   à Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.<>c__DisplayClass5.<FindAttachableProperties>b__4(ITypeMetadata walkType)
   à MS.Internal.Design.Metadata.Xaml.XamlType.<GetAllAttachableProperties>d__7.MoveNext()
   à MS.Internal.Design.Metadata.Xaml.XamlType.<FindAttachableProperties>d__0.MoveNext()
   à Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.<FindAttachableProperties>d__7.MoveNext()
   à MS.Internal.VirtualModel.VirtualModelPropertyCollection.<GetUncachedProperties>d__0.MoveNext()
   à System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   à System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   à MS.Internal.VirtualModel.VirtualModelPropertyCollection.GetEnumerator()
   à MS.Internal.VirtualModel.VirtualModelUtilities.WrapProperties(IVirtualModelItem item)
   à MS.Internal.VirtualModel.VirtualModelItem.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
   à System.ComponentModel.TypeDescriptor.MergedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
   à System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes)
   à System.Windows.PropertyPath.ResolvePropertyName(String name, Object item, Type ownerType, Object context, Boolean throwOnError)
   à MS.Internal.Data.PropertyPathWorker.GetInfo(Int32 k, Object item, SourceValueState& svs)
   à MS.Internal.Data.PropertyPathWorker.ReplaceItem(Int32 k, Object newO, Object parent)
   à MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
   à MS.Internal.Data.ClrBindingWorker.AttachDataItem()
   à System.Windows.Data.BindingExpression.Activate(Object item)
   à System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
   à System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)
   à System.Windows.Data.BindingExpressionBase.OnAttach(DependencyObject d, DependencyProperty dp)
   à System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   à System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   à System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
   à System.Windows.FrameworkElement.SetBinding(DependencyProperty dp, BindingBase binding)
   à MS.Internal.GridControl.GridChildMarginAdorner.SetDragBinding(ModelItem source, Boolean dragging)
   à MS.Internal.GridControl.GridChildMarginAdornerProvider.ChildMarginAdornerPanel.CalcLayout(Boolean measure)
   à MS.Internal.GridControl.GridChildMarginAdornerProvider.ChildMarginAdornerPanel.MeasureOverride(Size availableSize)
   à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   à System.Windows.UIElement.Measure(Size availableSize)
   à MS.Internal.Interaction.BaseAdornerLayout.Measure(UIElement adorner, Size constraint)
   à MS.Internal.Interaction.AdornerLayer.MeasureOverride(Size constraint)
   à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   à System.Windows.UIElement.Measure(Size availableSize)
   à System.Windows.ContextLayoutManager.UpdateLayout()
   à System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   à System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   à System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   à System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   à System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Thank you for your help.

2

There are 2 best solutions below

0
On BEST ANSWER

I eventually solved my problem by uninstalling and reunstalling .NET 4.0, Visual Studio and Telerik. Seems like Telerik references are hard to manage.

Thank you for your answers !

0
On

Try this, it might help and give you more information about the cause of the exception:

  • start Visual Studio and open your project
  • start another instance of Visual Studio without opening any project in it
  • in the second instance go to DEBUG > Attach to Process... and select the first instance of Visual Studio where your project is opened
  • now still in the second instance go to DEBUG > Exceptions... and check the Thrown next to Common Language Runtime Exceptions

If the exception now occurs the other VS should catch it so that you can hopefully browse it and see the details (like the exception message or the affected property etc.).