Cannot resolve target name xxx - maybe something to do with JumpLists virtualization

7 posts, 0 answers
  1. Bernhard König
    Bernhard König avatar
    78 posts
    Member since:
    Nov 2009

    Posted 15 Mar 2012 Link to this post

    I came accross a strange problem in my app I wasn't able to reproduce for some time but now I might found the issue. Ocassionally, I got "Cannot resolve target name xxx" exceptions during playing animations (triggered by a DataStateBehavior) while I was sure that the target name exists - because most of the time, everythign works fine.

    Now, the DataStateBehavior that triggers the animation that animates the control with the not found target name, is inside an ItemTemplate of a RadJumpList. The animation plays when an item gets marked read by the user. It seems that the following happens:

    • Opening a list with a few hundret items seems to work fine. If the user selects the function "mark all read", what will trigger the animation inside all of the items, work fine!
    • Scrolling down a bit, opening an item, going back to the list, marking all as read - still everythings fine.
    • But if I start scrolling far down the list, i.e. to the end and so a few hundred items down and THEN hit "mark all read", this exception appears.

     

    So, my theory is: when items get added to the view during scrolling down due to JumpList's virtualization handling, that works fine. But while going down, AFAIK JumpLists starts to remove items you have passed again from the actual view/list and "virutalizes" them.
    It seems that this happens only partional for some reason, the DataStateBehavior (I use the one that comes with Expression Blend's Interactivity assemblies) still seems to fire data state changes inside the again-virtualized items, what triggers an animation and this animation cannot find the target names of the animation targets specified in the animation as the items aren't really inside the list anymore.

    Okay, so far my theory but my question is: can this be the case? I don't want to say that this is actually a bug of the JumpList but you know, it seems my problem has at least something to do with it.

    It wold be great if you can confirm that this can be the source of my problem here and maybe with your Silverlight expert knowledge, can come up with some solution how I could prevent this behavior?

    Any help would be greatly appreciated :)

    Thanks,
    Bernhard

  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 19 Mar 2012 Link to this post

    Hello Bernhard,

    Thanks for writing.

    Based on your description I cannot exactly say what the problem could be.

    I can confirm that when items are recycled in RadJumpList, they are not actually removed from the layout, but simply collapsed (so that they're not rendered) and marked as recycled - but that's just our internal mark.

    Since you're the first to report similar behavior, I guess it might be related somehow to this DataStateBehavior you're using and the way it resolves items which should be animated.

    My advise is to either try replacing this DataStateBehavior with our ItemAnimation support (and see whether it'll fix the issue) or simply try to isolate the case in a sample project which we can debug.

    Let me know in case I can be of further help.

    All the best,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Bernhard König
    Bernhard König avatar
    78 posts
    Member since:
    Nov 2009

    Posted 19 Mar 2012 Link to this post

    Hi Deyan,

    thanks for writing back!

    What exactly is this ItemAnimation support you mentioned? I searched the documentation but didn't find anything that matched this word.

    Just fyi: the DataStateBehavior is a behavior that comes with Expression Blend that can be used to switch between visual states. I can bind this behavior to a property in my ViewModel and based on this value the behavior sets the defined visual state on my UI element, in this case a ListBoxItem where I have defined two different visual states.

    So what I achieve here is to animate a few controls inside my ItemTemplate when a property of the bound DataItem, and thus the ViewState, changes. Would this be possible with the ItemAnimation support you mentioned?

    If yes, I'll try it, if not, I try to put a sample project together or send you my complete solution with reproduce steps.

    Thanks,
    Bernhard
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 19 Mar 2012 Link to this post

    Hello Bernhard,

    Thanks for writing back and for the provided details.

    The ItemAnimation support exposed by RadDataBoundListBox/RadJumpList (http://www.telerik.com/help/windows-phone/raddataboundlistbox-features-itemanimations-overview.html)
    can be used to animate the whole visual item, not visual elements in it. So, I guess that this is not the approach that is suitable for your scenario.

    In this case I will really need a sample project that reproduces the exception to be able to help.

    Regards,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Bernhard König
    Bernhard König avatar
    78 posts
    Member since:
    Nov 2009

    Posted 19 Mar 2012 Link to this post

    Your statement that it's rather unlikely that virutalization itself can cause this might send me in the right direction ... it could be that it's a race condition. I remove items from the list sometimes when they are marked read, and if the removal happens before the DataSateBehavior triggers the animation ... of course this could cause the crash.

    I just have one question that might help me understand the problem better: it's because it only happens if I scrolled through a longer list of items before the problem appears. So: as JumpList uses virtualization, am I right that you realize/generate, let's say, only 20 items in the list in the beginning. All other items in the list are in my ObservableCollection, but were not really added into the JumpList as UI elements, right? When I scroll down, you start to generate more of them.

    So only the first 20 data items would have an actual UI item in the list, including the DataStateBehavior that listens to property changes and triggers animations. Only when I scroll down the list the number of really generated items will increase.

    So my assumption is now that because this DataStateBehavior is property bound and each property that raises a PropertyChanged event is handled seperately (and needs to be invoked to the UI thread seperately), this could cause that this process of marking the items read and processing the Visual State changes, takes longer and longer the more i scroll down the list (as more and more items get realized in the UI that weren't initially).

    So here's the chance that another thread that removes items outruns this thread and bang, we have the exception.

    It would be great if you could confirm my assumptions that JumpList behaves like this so I know I'm looking in the right direction. Will be a little hard to debug as many of the magic happens in Silverlight-internal libraries here.

    Edit: One intesting thing is, though, that this doesn't appear when using DataBoundListBox. I tried to reproduce this issue with an older version of my app where I still used DataBoundListBox (the relevant code parts remained unchanged) and I'm unable to make the app crash.

    Edit 2: No it's definitely no race condition, at least none caused by my code, please foget this posting, I'll investigate further and try to put a sample project together. I monitored the thread behavior by debug outputs and saw that the exception also appears if my code was nowhere near removing items from the list. I also commented out the code that removes items and the exception still appears. Weird.

    Thank you very much,
    Bernhard

  7. Bernhard König
    Bernhard König avatar
    78 posts
    Member since:
    Nov 2009

    Posted 19 Mar 2012 Link to this post

    Ok, now I found something that should help:
    The problem does not appear if I use DataBoundListBox. I replaced the Jumplist with it, didn't change anything else, and it worked fine. Back to JumpList, error appears again.
    Then I commented out Sort and Group descriptors in JumpList and the exception didn't appear again even when using JumpList.
    Bad news is I wasn't able to reproduce this with a small and easy sample app but that might have to do with the fact I have no idea where this problem really is coming from. So I will need to send you my complete solution so you can have a look what might be going wrong here. I'm out of ideas what can cause this problem and your help is greatly appreciated.
    So I will prepare my solution for you and add some reproduce steps and guidelines and send you a support ticket as I don't want to publish my project in public forums.
    Thanks again,
    Bernhard

  8. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 20 Mar 2012 Link to this post

    Hello Bernhard,

    Your ticket with the attached solution has been handled. Take a look at it for further information.

    Kind regards,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
DevCraft banner