Expanding nested RecurringTask - Error

12 posts, 0 answers
  1. DKO
    DKO avatar
    23 posts
    Member since:
    Dec 2016

    Posted 01 Mar 2018 Link to this post

    Hello,

    I've based my code on the RecurringTask example project.
    I was able to get my desired visual result but I've now discovered an action that causes my application to crash.
    This makes it pretty much unusable, so I need to find a solution or at least a way to catch the exception and prevent it from crashing.

    I've been able to pinpoint the cause of my problem, but have been unable to solve this by myself.

    Let me start by describing my current situation/environment.

    In the RecurringTask_WPF example project if you collapse the "Recurrence Series" (the parent tree node) then you can see all the child recurring tasks next to each other.
    When you click on one of the events, so for example: "Recurrence 1"  block (in the TimeRuler Part of the RadGanttView), then this specific recurring task gets selected. This causes the tree node to be expanded automatically and the selected task/event becomes highlighted.

    This behaviour works perfectly as intended and I wish to keep it like that exactly.
    However once you nest recurring tasks into one extra level of hierarchy, which is on my requirements, an exception is thrown and the program stops working.

    First I'll give you the code that changes the example project in order to recreate the problem. (This should also help with explaining the exact problem)
    You should replace the GetTasks() method of the ViewModel.cs with the code below:

    private ObservableCollection<IGanttTask> GetTasks()
    {
        var collection = new ObservableCollection<IGanttTask>();
        var today = DateTime.Today.AddHours(8);
        var child1 = new RecurrenceTask(today, today.AddHours(4), "Reccurence 1");
        var child2 = new RecurrenceTask(today.AddHours(0), today.AddHours(12), "Reccurence 2");
        var child3 = new RecurrenceTask(today.AddHours(13), today.AddHours(20), "Reccurence 3");
        var task2 = new RecurrenceTask(today.AddHours(13), today.AddHours(20), "Recurrence Series2")
            {
                Children = { child3 }
            };
        var task1 = new RecurrenceTask(today, today.AddHours(20), "Recurrence Series1")
        {
            Children = { child1, child2, task2 }
        };
        collection.Add(task1);
        var taskWithoutRecurrence = new GanttTask(today.AddHours(8), today.AddHours(13), "Task Without Recurrence");
        taskWithoutRecurrence.Children.Add(new GanttTask(today.AddHours(9), today.AddHours(12), "Child Task"));
        collection.Add(taskWithoutRecurrence);
        return collection;
    }

     

    When you run the example with these code changes, you should see that the "Recurrence 3" task now is moved into a new "Recurrence Series2".
    This new series is also a child of the original "Recurrence Series1".
    So when then all the nodes become collapsed you can still see all child recurrences next to each other.
    If you now click on the "Recurrence 3" event (in the TimeRuler Part of the RadGanttView) the application will throw a System.NullReferenceException.

    This is the StackTrace  (it is in Dutch, but I believe it should still be readable):

       bij System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
    bij System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
    bij Telerik.Windows.Rendering.VirtualizedGridPanel.Handler.SetArrangeRect(Int32 column, Int32 row, Rect rect)
    bij Telerik.Windows.Rendering.Internal.GridRenderingHelper.MeasureItemsCore(Rect viewport, IGridContainersHandler handler)
    bij Telerik.Windows.Rendering.Internal.GridRenderingHelper.MeasureItems(Rect viewport, IGridContainersHandler handler)
    bij Telerik.Windows.Rendering.VirtualizedGridPanel.MeasureContainers(IContainerRecycler recycler, Size availableSize)
    bij Telerik.Windows.Rendering.Virtualization.VirtualizedPanel.MeasureOverrideCore(Size availableSize)
    bij Telerik.Windows.Rendering.ScrollablePanel.MeasureOverride(Size availableSize)
    bij System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    bij System.Windows.UIElement.Measure(Size availableSize)
    bij Telerik.Windows.Controls.GanttPresenterPanel.MeasureContainer(UIElement container, Size measureSize)
    bij Telerik.Windows.Controls.GanttPresenterPanel.MeasureOverride(Size availableSize)
    bij System.Windows.FrameworkElement.MeasureCore(Size availableSize)

     

    Here are some other observations that might help you find the exact cause of this problem:

    • If you were to click any other recurring task then the program would keep working as expected.
    • If only the top note is collapsed and the child "Recurrence Series2" stays expanded, then the behaviour also keeps working as expected

    It would seem that the problem only occurs when nested nodes are collapsed and a child task of a hierarchy that is at least 2 levels deep gets selected.

    Now I would just like to find a way to stop my program from crashing.
    I've tried handling click events in order to prevent the user from clicking on events in the TimeRuler Part of the RadGanttView, but I wasn't able to figure out how to and I would also still like to keep the behaviour of the automatic expanding and selecting the specific task.

    I've also tried to implement a click-command which showed me that the expanding actually works correctly and the exception only occurs afterwards.

    Any help would be very much appreciated.

     

     

     

     

  2. Koen Van Wijmeersch
    Koen Van Wijmeersch avatar
    6 posts
    Member since:
    Dec 2009

    Posted 05 Mar 2018 Link to this post

    I have a very similar problem.

    Exception:

    bij System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
       bij Telerik.Windows.Rendering.Virtualization.RecyclingContext.ContainerRecycler.FreeContainerByItem(Object data)
       bij Telerik.Windows.Rendering.Internal.GridRecyclingHelper.Recycle(Range`1 horizontalRange, Range`1 verticalRange, IContainerRecycler recycler)
       bij Telerik.Windows.Rendering.VirtualizedGridPanel.MeasureContainers(IContainerRecycler recycler, Size availableSize)
       bij Telerik.Windows.Rendering.Virtualization.VirtualizedPanel.MeasureOverrideCore(Size availableSize)
       bij Telerik.Windows.Rendering.ScrollablePanel.MeasureOverride(Size availableSize)
       bij System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       bij System.Windows.UIElement.Measure(Size availableSize)
       bij Telerik.Windows.Controls.GanttPresenterPanel.MeasureOverride(Size availableSize)
       bij System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       bij System.Windows.UIElement.Measure(Size availableSize)
       bij System.Windows.Controls.Control.MeasureOverride(Size constraint)

     

    It seems like this only happens when you collapse a node that contains a summary level with 2 or more children.

    Regards

    Koen

     

  3. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2515 posts

    Posted 06 Mar 2018 Link to this post

    Hi,

    I will check this and get back in this thread a bit later.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  4. DKO
    DKO avatar
    23 posts
    Member since:
    Dec 2016

    Posted 06 Mar 2018 in reply to Martin Ivanov Link to this post

    I still haven't managed to fix this by myself, so I'm looking forward to your feedback/input.

  5. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2515 posts

    Posted 08 Mar 2018 Link to this post

    Hello guys,

    I checked your description and I can confirm that there are two separate issues that can be reproduced with the provided steps. I logged two issues in our feedback portal and updated your Telerik points. I am afraid currently, I cannot suggest a workaround for resolving this. That's why I would recommend you to follow the items in the portal. 

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  6. Lluis
    Lluis avatar
    3 posts
    Member since:
    Oct 2016

    Posted 10 Apr 2018 Link to this post

    Some one have the solution ? I need the solution for my company.... :(
  7. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2515 posts

    Posted 11 Apr 2018 Link to this post

    Hello Lluis,

    Still, there is no workaround that we can suggest for those issues. I would recommend you to follow the items in the feedback portal. This way you will be notified as soon as there is a change in their status.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  8. Daniel Banda
    Daniel Banda avatar
    2 posts
    Member since:
    Jun 2018

    Posted 12 Oct 2018 Link to this post

    I'm having the same situation right now.

    Did anyone come up with a solution?

     

    Regards,

    -Daniel

  9. yongcheol
    yongcheol avatar
    3 posts
    Member since:
    Jun 2020

    Posted 29 Jul Link to this post

    hi telerik 

    how to find this problem has solve?

  10. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2515 posts

    Posted 30 Jul Link to this post

    Hello Yongcheol,

    The issues linked in this thread (check this reply) are resolved in 2019. You can see the concrete release in the items in the feedback portal. To confirm the issue resolution, you can get the latest version of Telerik UI for WPF and test it against your setup. If the issue still reproduces, I would suggest you to write here or in the feedback portal with information on the exact setup and the issue.

    Regards,
    Martin Ivanov
    Progress Telerik

  11. yongcheol
    yongcheol avatar
    3 posts
    Member since:
    Jun 2020

    Posted 30 Jul in reply to Martin Ivanov Link to this post

    hi Martin Ivanov

     

    I am using the latest version of telerik UI for WPF.

    and don't find solve in your link page(feedback portal) 

    where are going a i get a  solve??

  12. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2515 posts

    Posted 31 Jul Link to this post

    Hello Yongcheol,

    The following two issues are considered resolved. You can indicate this by the Completed status in the feedback portal.

    If you still experience those issues or if you have another issue I recommend you to open a new forum or a support ticket and describe the exact issue and your setup there.

    Regards,
    Martin Ivanov
    Progress Telerik

Back to Top