WPF Designer : System.ArgumentNullException

本文关键字:ArgumentNullException System Designer WPF | 更新日期: 2023-09-27 18:34:53

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

我已经在 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)

谢谢你的帮助。

WPF Designer : System.ArgumentNullException

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

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

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

我最终通过卸载和重新卸载.NET 4.0,Visual Studio和Telerik解决了我的问题。似乎 Telerik 引用很难管理。

谢谢你的回答!

相关文章:
  • 没有找到相关文章