WPF设计器:System.ArgumentNullException

时间:2014-12-22 14:06:19

标签: c# wpf xaml designer argumentnullexception

首先,抱歉我的英语不好。我在这里发帖是因为我知道有些人有非常相关的答案。

我已经在WPF应用程序上工作了几个月没有任何问题。从今天早上开始,每次我尝试单击,更新或调整设计器中的元素时,都会发生异常,我必须每隔10秒重新加载一次设计器。

这有点烦人,我真的无法弄清楚如何解决这个问题。

这是错误:

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)

感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

试试这个,它可能有所帮助,并为您提供有关异常原因的更多信息:

  • 启动Visual Studio并打开您的项目
  • 启动另一个Visual Studio实例,而不打开其中的任何项目
  • 在第二个实例中
  • 转到DEBUG > Attach to Process...并选择项目打开的Visual Studio的第一个实例
  • 现在仍然在第二个实例中转到DEBUG > Exceptions...并查看Thrown旁边的Common Language Runtime Exceptions

如果现在发生异常,则其他VS应该捕获它,以便您可以希望浏览它并查看详细信息(如异常消息或受影响的属性等)。

答案 1 :(得分:0)

我最终通过卸载和重新安装.NET 4.0,Visual Studio和Telerik解决了我的问题。似乎Telerik的参考资料难以管理。

感谢您的回答!