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)
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'.
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)
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