Visual Studio Development Bookmark and Share   
 index > Visual Studio WPF Designer > Unhandled exception in WPF designer after installing Silverlight3 toolkit
 

Unhandled exception in WPF designer after installing Silverlight3 toolkit

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
Wolle98  Wednesday, August 05, 2009 9:21 AM
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.
  • Unmarked As Answer byWolle98 Wednesday, August 05, 2009 8:48 PM
  • Marked As Answer byWolle98 Wednesday, August 05, 2009 3:31 PM
  •  
Wolle98  Wednesday, August 05, 2009 3:31 PM
Hi Wolle98. I've just experienced the same error. I refused to uninstall Expression Blend 3 as I use the darned thing, but I found that uninstalling the WPF toolkit fixed VS2008. I hope it stays fixed, what a pita!

Janene
JaneneMc  Monday, August 24, 2009 4:02 PM
Wolle98,

Sorry you are having a problem.

I've got Expression Blend 3 (not trial version), VS 2008 SP1, Silverlight 3 Developer runtime, Silverlight 3 SDK and Silverlight 3 Toolkit on two of my personal machines without any issues.

Basically what I did when Blend 3 was released was to leave VS as is, uninstall all Silverlight and Blend versions.

Then I installed the Silverlight 3 Developer runtime, Silverlight 3 SDK and Silverlight 3 Toolkit.

Then Blend 3.

I hope this helps.

If you can't get your install sorted out, please respond to this thread.

Cheers, Karl - Microsoft Product Team, Code Project MVP - http://karlshifflett.wordpress.com/
karl140.6  Wednesday, August 26, 2009 4:15 PM
Wolle98 and all,

I had a similiar error in my Cider and Blend, although a slightly different codestack. I found that one of my resource styles did not have a TargetType which caused a "cannot create instance of GenericTheme," from within the WPFToolkit.

I hope this, in some way, helps to solve your issue.

thanks,
Jim
jimgale  Wednesday, September 09, 2009 10:55 AM
Hi All

Several customers have found that they see issues like this when they have the June CTP of the WPF Toolkit controls installed prior to installing Blend 3.

If you're seeing this issue, please try removing the June CTP of the WPF Toolkit, removing Blend 3, and re-installing it. You shouldn't need to install the toolkit to get the charting controls once you have Blend 3.

Mark



Mark Wilson-Thomas - Program Team - WPF & SL Designer for Visual Studio - posts are provided 'as-is'
Mark Wilson-Thomas  Tuesday, October 13, 2009 3:55 PM

You can use google to search for other answers

Custom Search

More Threads

• No WPF Designer available in VS2008 VC#
• advanced designtime support for my robot usercontrol
• Listbox Child Control Event
• Binding same Datatable to different grids
• no xaml intellisense at all
• drilldown to an image
• How do I see the WPF Designer?
• Property Windows and XAML editor do not cooperate correctly
• Property categorization and "Common Properties"
• Visual Studio 2008 or Expression Blend?