Unable to cast object of type 'MS.Internal.ManagedObjectReference' to type 'Telerik.Windows.Controls.Animation

8 posts, 0 answers
  1. Ramesh
    Ramesh avatar
    2 posts
    Member since:
    Jul 2010

    Posted 06 Apr 2011 Link to this post

    I use 2011 March version of Telerik Silverlight controls. I get the following exception some times when RadComboBox dropdown opens. There is nothing special about these RadComboBox in the XAML, see below for a sample.

     

     

     

    <telerik:RadComboBox

     

     

     

    DisplayMemberPath="Name"

     

     

     

    SelectedValuePath="RefDataID"

     

     

     

    SelectedValue="{Binding RefID, Mode=TwoWay, NotifyOnValidationError=true}"

     

     

     

    ItemsSource="{Binding Source={StaticResource Reference}}" />

     


    System.Windows.Markup.XamlParseException occurred
      Message= [Line: 0 Position: 0]
      LineNumber=0
      LinePosition=0
      StackTrace:
           at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
      InnerException: System.InvalidCastException
           Message=Unable to cast object of type 'MS.Internal.ManagedObjectReference' to type 'Telerik.Windows.Controls.Animation.AnimationSelectorBase'.
           StackTrace:
                at Telerik.Windows.Controls.Animation.AnimationManager.GetAnimationSelector(DependencyObject obj)
                at Telerik.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(DependencyObject element, Object item)
                at Telerik.Windows.Controls.RadComboBox.PrepareContainerForItemOverride(DependencyObject element, Object item)
                at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
                at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
                at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 containerIndex, DependencyObject container, Boolean needPrepareContainer)
                at System.Windows.Controls.ItemsControl.AddContainers()
                at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr unmanagedObj)
           InnerException:
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 12 Apr 2011 Link to this post

    Hi Ramesh,

    Thank you for contacting us.

    We are not aware of such issue. Could you please try with the Latest Internal Build from yesterday. If the problem persists please send us your project, so that we can run it here locally and track down the source of the problem.

    Looking forward to your reply.

    Regards,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Chris
    Chris avatar
    19 posts
    Member since:
    Jul 2011

    Posted 02 Apr 2012 Link to this post

    I've ran into this same issue, please advise?

      System.Windows.Markup.XamlParseException occurred

      Message= [Line: 0 Position: 0]

      LineNumber=0

      LinePosition=0

      StackTrace:

           at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)

      InnerException: System.InvalidCastException

           Message=Unable to cast object of type 'MS.Internal.ManagedObjectReference' to type 'Telerik.Windows.Controls.Animation.AnimationSelectorBase'.

           StackTrace:

                at Telerik.Windows.Controls.Animation.AnimationManager.GetAnimationSelector(DependencyObject obj)

                at Telerik.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(DependencyObject element, Object item)

                at Telerik.Windows.Controls.RadComboBox.PrepareContainerForItemOverride(DependencyObject element, Object item)

                at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)

                at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)

                at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 containerIndex, DependencyObject container, Boolean needPrepareContainer)

                at System.Windows.Controls.ItemsControl.AddContainers()

                at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr nativeItemsControl)

           InnerException:

  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 05 Apr 2012 Link to this post

    Hello Chris,

    With which version of the controls you are receiving this exception? Also, if you could send us the code that is raising this exception and some more details how to reproduce it. In that way we will be able to start researching the issue and provide a fix in a timely manner.

    Thank you in advance.

    Regards,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Dumitru
    Dumitru avatar
    4 posts
    Member since:
    Mar 2011

    Posted 27 Apr 2012 Link to this post

    Latest version: 2012.1.424.1050. Same exception here. But even in our project this bug happens in 1 case of 20+, so I think its very hard to reproduce this in another simple project.
    Here some info I found, not sure if it somehow will help, but imho - this is better then nothing, maybe someone will find this useful.

    Exception message: 
    System.InvalidCastException occurred
      Message=Unable to cast object of type 'MS.Internal.ManagedObjectReference' to type 'Telerik.Windows.Controls.Animation.AnimationSelectorBase'.
      StackTrace:
           at Telerik.Windows.Controls.Animation.AnimationManager.GetAnimationSelector(DependencyObject obj)
      InnerException: 


      This i took from "Locals" window:
      + target {Telerik.Windows.Controls.RadComboBox} System.Windows.FrameworkElement {Telerik.Windows.Controls.RadComboBox}
    animationName "Expand" string

    Stack Traces (exception is thrown a few times in a row):
    1)

    Telerik.Windows.Controls!Telerik.Windows.Controls.Animation.AnimationManager.GetAnimationSelector(System.Windows.DependencyObject obj) + 0x5a bytes
    Telerik.Windows.Controls!Telerik.Windows.Controls.Animation.AnimationManager.Play(System.Windows.FrameworkElement target, string animationName, System.Action completeCallback, bool animateSelf, object[] args) + 0x13c bytes
    Telerik.Windows.Controls!Telerik.Windows.Controls.Animation.AnimationManager.Play(System.Windows.FrameworkElement target, string animationName, System.Action completeCallback, object[] args) + 0x35 bytes
    Telerik.Windows.Controls!Telerik.Windows.Controls.AutoClosePopupWrapper.OnPopupOpened(object sender, System.EventArgs e) + 0x13c bytes
    System.Windows.dll!MS.Internal.CoreInvokeHandler.InvokeEventHandler(uint typeIndex, System.Delegate handlerDelegate, object sender, object args) + 0x1b3 bytes
    System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj, System.IntPtr unmanagedObjArgs, int argsTypeIndex, int actualArgsTypeIndex, string eventName, uint flags) + 0x38d bytes


    2)

    Telerik.Windows.Controls!Telerik.Windows.Controls.Animation.AnimationManager.GetAnimationSelector(System.Windows.DependencyObject obj) + 0x5a bytes
    Telerik.Windows.Controls!Telerik.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(System.Windows.DependencyObject element, object item) + 0x40f bytes
    Telerik.Windows.Controls.Input!Telerik.Windows.Controls.RadComboBox.PrepareContainerForItemOverride(System.Windows.DependencyObject element, object item) + 0x3b bytes
    System.Windows.dll!System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(System.Windows.DependencyObject container, object item) + 0x26 bytes
    System.Windows.dll!System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(System.Windows.DependencyObject container) + 0x3d bytes
    System.Windows.dll!System.Windows.Controls.ItemsControl.AddVisualChild(int containerIndex, System.Windows.DependencyObject container, bool needPrepareContainer) + 0x80 bytes
    System.Windows.dll!System.Windows.Controls.ItemsControl.AddContainers() + 0xb5 bytes
    System.Windows.dll!System.Windows.Controls.ItemsControl.RecreateVisualChildren(System.IntPtr nativeItemsControl) + 0x56 bytes
    [Managed to Native Transition]
    System.Windows.dll!MS.Internal.XcpImports.MethodEx(System.IntPtr ptr, string name, MS.Internal.CValue[] cvData) + 0xcd bytes
    System.Windows.dll!MS.Internal.XcpImports.MethodEx(System.Windows.DependencyObject obj, string name) + 0x2c bytes
    System.Windows.dll!MS.Internal.XcpImports.FrameworkElement_ApplyTemplateInternal(System.Windows.FrameworkElement frameworkElement) + 0x22 bytes
    System.Windows.dll!System.Windows.Controls.ScrollContentPresenter.HookupScrollingComponents() + 0x8c bytes
    System.Windows.dll!System.Windows.Controls.ScrollContentPresenter.OnApplyTemplate() + 0x14 bytes
    System.Windows.dll!System.Windows.FrameworkElement.OnApplyTemplate(System.IntPtr nativeTarget) + 0x55 bytes
    [Managed to Native Transition]
    System.Windows.dll!MS.Internal.XcpImports.UIElement_Measure(System.Windows.UIElement element, System.Windows.Size availableSize) + 0x43 bytes
    System.Windows.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x47 bytes
    System.Windows.dll!System.Windows.Controls.ScrollViewer.MeasureOverride(System.Windows.Size constraint) + 0x1bf bytes
    System.Windows.dll!System.Windows.FrameworkElement.MeasureOverride(System.IntPtr nativeTarget, float inWidth, float inHeight, out float outWidth, out float outHeight) + 0x9e bytes
    [Appdomain Transition]


    3)

    System.Windows.dll!MS.Internal.XcpImports.MethodEx(System.IntPtr ptr, string name, MS.Internal.CValue[] cvData) + 0x16d bytes
    System.Windows.dll!MS.Internal.XcpImports.MethodEx(System.Windows.DependencyObject obj, string name) + 0x2c bytes
    System.Windows.dll!MS.Internal.XcpImports.FrameworkElement_ApplyTemplateInternal(System.Windows.FrameworkElement frameworkElement) + 0x22 bytes
    System.Windows.dll!System.Windows.Controls.ScrollContentPresenter.HookupScrollingComponents() + 0x8c bytes
    System.Windows.dll!System.Windows.Controls.ScrollContentPresenter.OnApplyTemplate() + 0x14 bytes
    System.Windows.dll!System.Windows.FrameworkElement.OnApplyTemplate(System.IntPtr nativeTarget) + 0x55 bytes
    [Managed to Native Transition]
    System.Windows.dll!MS.Internal.XcpImports.UIElement_Measure(System.Windows.UIElement element, System.Windows.Size availableSize) + 0x43 bytes
    System.Windows.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize) + 0x47 bytes
    System.Windows.dll!System.Windows.Controls.ScrollViewer.MeasureOverride(System.Windows.Size constraint) + 0x1bf bytes
    System.Windows.dll!System.Windows.FrameworkElement.MeasureOverride(System.IntPtr nativeTarget, float inWidth, float inHeight, out float outWidth, out float outHeight) + 0x9e bytes
    [Appdomain Transition]

    And this is message given by IE 9 :

    Webpage error details


    User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
    Timestamp: Fri, 27 Apr 2012 13:37:35 UTC


    Message: Unhandled Error in Silverlight Application 
    Code: 4004    
    Category: ManagedRuntimeError       
    Message: System.Windows.Markup.XamlParseException:  [Line: 0 Position: 0] ---> System.InvalidCastException: Unable to cast object of type 'MS.Internal.ManagedObjectReference' to type 'Telerik.Windows.Controls.Animation.AnimationSelectorBase'.
       at Telerik.Windows.Controls.Animation.AnimationManager.GetAnimationSelector(DependencyObject obj)
       at Telerik.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(DependencyObject element, Object item)
       at Telerik.Windows.Controls.RadComboBox.PrepareContainerForItemOverride(DependencyObject element, Object item)
       at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
       at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
       at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 containerIndex, DependencyObject container, Boolean needPrepareContainer)
       at System.Windows.Controls.ItemsControl.AddContainers()
       at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr nativeItemsControl)
       --- End of inner exception stack trace ---
       at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
       at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
       at MS.Internal.XcpImports.FrameworkElement_ApplyTemplateInternal(FrameworkElement frameworkElement)
       at System.Windows.Controls.ScrollContentPresenter.HookupScrollingComponents()
       at System.Windows.Controls.ScrollContentPresenter.OnApplyTemplate()
       at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)     


    Line: 87
    Char: 13
    Code: 0
    URI: http://stage-ngnms-server/index.html

  7. Dumitru
    Dumitru avatar
    4 posts
    Member since:
    Mar 2011

    Posted 30 Apr 2012 Link to this post

    Looks like removing this animation from RadComboBoxStyle fixes the bug, or at least I can't reproduce it at the moment:
    <Setter Property="animation:AnimationManager.AnimationSelector">
          <Setter.Value>
            <animation:AnimationSelector>
              <animation:AnimationGroup AnimationName="Expand">
                <animation:SlideAnimation Direction="In" SlideMode="Top" TargetElementName="PopupRoot" />
              </animation:AnimationGroup>
              <animation:AnimationGroup AnimationName="Collapse">
                <animation:SlideAnimation Direction="Out" SlideMode="Top" TargetElementName="PopupRoot" />
              </animation:AnimationGroup>
            </animation:AnimationSelector>
          </Setter.Value>
        </Setter>


  8. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 03 May 2012 Link to this post

    Hello Dumitru,

    We are still not able to reproduce the issue. However, we will look into it further. Meanwhile, if you succeed in reproducing it in a sample project, open a support ticket and send it to us. In that way we will be able to track the problem in a timely manner.
    I have logged the issue in PITS - you can track it here. Once we find a solution for the problem its status will be updated.

    Greetings,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  9. Dumitru
    Dumitru avatar
    4 posts
    Member since:
    Mar 2011

    Posted 04 May 2012 Link to this post

    Thank You!
    As I said, even in our project this bug doesn't happen always, only when app is running some time, and you actively use the combo box. So I don't think I can provide a sample solution that reproduces this.
    Also i just got same exception with the same animation in RadExpander, so I think we will just remove all this kind of animation from all styles.
Back to Top
DevCraft banner