locked
InvalidOperationException in Blend 2 SP1 RRS feed

  • Question

  • I am using Blend 2 SP1 to create a storyboard to animate moving an ellipse around in a canvas.  Here is the XAML of the storyboard:

      <Storyboard x:Name="_myStoryboard">
       <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_myEllipse" Storyboard.TargetProperty="(Canvas.Left)">
        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="345"/>
        <SplineDoubleKeyFrame KeyTime="00:00:02" Value="650"/>
        <SplineDoubleKeyFrame KeyTime="00:00:04" Value="345"/>
        <SplineDoubleKeyFrame KeyTime="00:00:06" Value="40"/>
        <SplineDoubleKeyFrame KeyTime="00:00:08" Value="345"/>
       </DoubleAnimationUsingKeyFrames>
       <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_myEllipse" Storyboard.TargetProperty="(Canvas.Top)">
        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="30"/>
        <SplineDoubleKeyFrame KeyTime="00:00:02" Value="100"/>
        <SplineDoubleKeyFrame KeyTime="00:00:04" Value="170"/>
        <SplineDoubleKeyFrame KeyTime="00:00:06" Value="100"/>
        <SplineDoubleKeyFrame KeyTime="00:00:08" Value="30"/>
       </DoubleAnimationUsingKeyFrames>
      </Storyboard>

    Whenever I click on one of the KeyFrames in the timeline I get the following:

    An Exception was thrown.

    InvalidOperationException: 2213 An error has occurred.

    StackTrace
    at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
    at System.Windows.Media.Animation.Storyboard.Begin()
    InnerException: None

    Is this a known issue? Any thoughts on how to workaround or fix it? 

    Thanks In Advance
    Friday, November 14, 2008 6:38 PM

All replies

  • Hi,

    I cannot reproduce this issue. I used your Storyboard XAML to animate the ellipse in a Canvas. It works fine for me. Could you please share out the entire XAML or the project if possible as it might help to track down the issue.

    Here is the XAML I have

     <UserControl.Resources>
      <Storyboard x:Name="_myStoryboard">
       <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_myEllipse" Storyboard.TargetProperty="(Canvas.Left)">
           <SplineDoubleKeyFrame KeyTime="00:00:00" Value="345"/>
           <SplineDoubleKeyFrame KeyTime="00:00:02" Value="650"/>
           <SplineDoubleKeyFrame KeyTime="00:00:04" Value="345"/>
           <SplineDoubleKeyFrame KeyTime="00:00:06" Value="40"/>
           <SplineDoubleKeyFrame KeyTime="00:00:08" Value="345"/>
          </DoubleAnimationUsingKeyFrames>
          <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_myEllipse" Storyboard.TargetProperty="(Canvas.Top)">
           <SplineDoubleKeyFrame KeyTime="00:00:00" Value="30"/>
           <SplineDoubleKeyFrame KeyTime="00:00:02" Value="100"/>
           <SplineDoubleKeyFrame KeyTime="00:00:04" Value="170"/>
           <SplineDoubleKeyFrame KeyTime="00:00:06" Value="100"/>
           <SplineDoubleKeyFrame KeyTime="00:00:08" Value="30"/>
          </DoubleAnimationUsingKeyFrames>
        </Storyboard>
     </UserControl.Resources>

     <Canvas x:Name="LayoutRoot" Background="White">
      <Ellipse Height="100" Width="100" Fill="#FFFFFFFF" Stroke="#FF000000" x:Name="_myEllipse"/>
     </Canvas>

    Thanks!
    Jeetendra Kukreja [MSFT]
    Monday, November 17, 2008 8:17 PM
  • Perhaps the target of the Storyboard _myEllipse does not exist in the document. In that case I do see the exception you mention.

    Thanks!
    Jeetendra Kukreja [MSFT]
    Monday, November 17, 2008 8:19 PM
  • I actually received this same error when I created a content control. I tried to attach storyboard animations to child controls in a custom user control that used the child control concept. Despite that, it can never actually find the element. I haven't figured a way around though.
    Thomas
    Thursday, February 19, 2009 5:23 AM
  • I have the same issue. I built a spline animation in VS2008 and it works OK. Then I pull it up in blend, thinking I'll be able to tweak it better there. When I click on the animation object in the Objects and Timeline pulldown I get an "2213 An error has occured" message on the design surface. Seems that I need to restart the app to get around it. Lame.

    Keep in mind, this is a valid, working animation. It runs in IE. Just causes an error in blend. Here's the xaml for the animation:

     <Storyboard x:Name="uxTranslateImagesAnimated" AutoReverse="False">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="uxTranslatePics" Storyboard.TargetProperty="X"  >
                    <SplineDoubleKeyFrame KeyTime="0:0:2" Value="-200" KeySpline="0.25,0.75 0.20, 0.85"/>
                    <SplineDoubleKeyFrame KeyTime="0:0:5" Value="-500" KeySpline="0.40,0.95 0.57, 0.95"/>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

    I'm using 2.1.1760.0, that's 2 SP1. I gotta say, as many bugs as I've seen today, no way I'm buying this tool.
    Sunday, April 19, 2009 6:40 PM
  • Hi,

    For such errors it would be great if you share the entire XAML since the storyboards target elements which are not included in your xaml. Boot2TheHead2, is the control you are targetting a custom type? The error message looks it is originating from Silverlight. Can you share the project? It might help investigate the issue better.

    Also, you can try the latest preview of Blend 3 at http://www.microsoft.com/expression/try-it/blendpreview.aspx targetting the Silverlight 3 Beta to see if the issue has been fixed there.

    Thanks!
    Jeetendra Kukreja [MSFT]
    Wednesday, April 29, 2009 3:27 AM