安装Silverlight3工具包后WPF设计器中的未处理异常 [英] Unhandled exception in WPF designer after installing Silverlight3 toolkit

查看:93
本文介绍了安装Silverlight3工具包后WPF设计器中的未处理异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!昨天我在WPF应用程序上工作并试用了WPF图表控件。到目前为止工作得很好。后来我安装了Silverlight3工具包。之后,带有SP1的VS2008中的WPF设计器在打开WPF应用程序时开始抛出未处理的异常。例如,


Hi everybody!

Yesterday I worked on a WPF application and tried out the WPF charting control. Worked fine so far. Later I installed the Silverlight3 toolkit. After that, the WPF designer in VS2008 with SP1 started to throw unhandled exceptions when opening the WPF applications., e.g.

'MS.Internal.Interaction.DesignerResources.ElementBorderKey' resource not found.
   at MS.Internal.Helper.FindResourceHelper.DoTryCatchWhen(Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)



这个错误列表在UI上显示两个错误element:


The error list shows two errors on an UI element:

Cannot create instance of 'GenericTheme' defined in assembly 'Microsoft.Windows.Design.Interaction, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Exception has been thrown by the target of an invocation.  


Unable to cast object of type 'MS.Internal.NamedObject' to type 'System.Windows.Media.Brush'.



删除导致此错误的UI元素后,我在设计器中得到另一个异常:
$


After deleting the UI element that causes this error, I get another exception in the designer:

Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
   at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at Microsoft.Windows.Design.Features.FeatureManager.FeatureConnectorEntry.AttemptActivate()
   at Microsoft.Windows.Design.Features.FeatureManager.FeatureConnectorEntry.OnRequirementsChanged(Object sender, EventArgs e)
   at Microsoft.Windows.Design.RequirementValidator.OnRequirementChanged(Object sender, EventArgs e)
   at Microsoft.Windows.Design.RequirementSubscription.OnRequirementChanged()
   at Microsoft.Windows.Design.RequiresContextItemAttribute.RequireContextItemSubscription.OnContextItemChanged(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 Microsoft.Windows.Design.Interaction.DesignerView.set_Context(EditingContext value)
   at MS.Internal.Designer.SimpleViewManager.get_View()
   at Microsoft.Windows.Design.Documents.MarkupDocumentManager.get_View()
   at MS.Internal.Host.PersistenceSubsystem.get_DocumentView()
   at MS.Internal.Host.Designer.get_View()
   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()

 
Unable to cast object of type 'MS.Internal.NamedObject' to type 'System.Windows.Input.Cursor'.
   at MS.Internal.Interaction.DesignerResources.GetCursor(ResourceKey key)
   at MS.Internal.GridControl.GridPanelAdorner..ctor(Grid grid)
   at MS.Internal.GridControl.GridDesigner..ctor(ModelItem gridItem)
   at MS.Internal.GridControl.GridDesigner.GetDesigner(ModelItem gridItem)
   at MS.Internal.GridControl.AlwaysVisibleGridAdornersProvider.Activate(ModelItem item, DependencyObject view)
   at Microsoft.Windows.Design.Interaction.AdornerProvider.InvokeActivate(EditingContext context, ModelItem item, DependencyObject view)
   at MS.Internal.Features.AdornerProviderFeatureConnector.FeatureProvidersAdded(ModelItem item, IEnumerable`1 extensions)
   at Microsoft.Windows.Design.Features.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.EditingContext.DefaultContextItemManager.Subscribe(Type contextItemType, SubscribeContextCallback callback)
   at Microsoft.Windows.Design.ContextItemManager.Subscribe[ContextItemType](SubscribeContextCallback`1 callback)
   at MS.Internal.Features.PolicyDrivenToolFeatureConnector`1..ctor(FeatureManager manager)
   at MS.Internal.Features.AdornerProviderFeatureConnector..ctor(FeatureManager manager)



即使应用程序当前不包含任何图表,当我删除对图表装配的引用时,一切正常再次。图表程序集包含WPF和Silverlight的代码。可能由于某种原因,WPF和Silverlight混淆了吗?

有任何建议如何解决这个问题?

谢谢,
Wolle98


Even if the application currently does not contain any chart, when I delete the reference to the charting assembly, everything works fine again. The charting assembly contains code for both, WPF and Silverlight. Might it be possible, that WPF and Silverlight get mixed up for some reason?

Any suggestions how to fix this issue?

Thanks,
Wolle98

推荐答案

卸载Expression Blend 3试用版后,VS2008中的WPF设计器再次工作,即使引用了图表组件。
似乎VS2008不喜欢Expression安装Silverlight3工具时要安装Blend 3.
After uninstalling the Expression Blend 3 Trial, the WPF designer in VS2008 works again, even with a reference to the charting assembly.
Seems VS2008 doesn't like Expression Blend 3 to be installed, when the Silverlight3 tools are installed.


这篇关于安装Silverlight3工具包后WPF设计器中的未处理异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆