Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Expression Blend 4 crashes with InvalidCastException when you multi-select controls in the object tree and are not derived from FrameworkElement.


Symptoms

Expression Blend 4 crashes with InvalidCastException when the following conditions are met:

1.    You have a type that is inherited from DependencyObject (and not FrameworkElement).

2.    An instance of that type is set as value for property of another control, and is selectable in the Blend object tree.

3.    You multi-select more than one of these control instances.

↑ Back to the top


Cause

InvalidCastException is thrown for invalid casting or explicit conversion. In this scenario, InvalidCastException occurs because the type inherits from DependencyObject, instead of FrameworkElement (or one of the types derived from FrameworkElement).

This is a known issue in Expression Blend 4.

↑ Back to the top


Workaround

To work around this issue, you can change the base type of the class from DependencyObject to FrameworkElement.

Inheritance Hierarchy
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement

Note: We assume that by changing the inherited class, your development project is not affected in an unfavorable way.

↑ Back to the top


More Information

We will take this issue into consideration in a future release of Expression Blend.  

↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 2489037
Revision : 1
Created on : 1/7/2017
Published on : 12/30/2010
Exists online : False
Views : 76