Setting ITickProvider of active MultidayViewDefinition to Zero causes crash or freeze

2 posts, 0 answers
  1. Wetzorke
    Wetzorke avatar
    13 posts
    Member since:
    Aug 2012

    Posted 21 Dec 2016 Link to this post

    Hello!

     

    - Setting Telerik.Windows.Controls.MultidayViewDefinition.MinorTickLength to Zero causes a ContextSwitchDeadlock during debugging and freezes the application when having the respective ViewDefinition active or on switching to the particular ViewDefinition.

    - Setting Telerik.Windows.Controls.MultidayViewDefinition.MajorTickLength or Telerik.Windows.Controls.TimelineViewDefinition.GroupTickLength to Zero both cause a System.OutOfMemoryException when having the respective ViewDefinition active or on switching to the particular ViewDefinition.

    - In XAML, when setting the MinorTickLength="0min" of the first and currently in the Designer active ViewDefinition will cause Visual Studio to freeze up entirely and needs to be terminated via the TaskManager.

    - In XAML, when setting the MajorTickLength="0min" or GroupTickLength="0min" of the first and currently in the Designer active ViewDefinition will render Visual Studio unresponsive for a few seconds until displaying that a System.OutOfMemoryException has occurred.

     

    Here's my example code to reproduce the crashes and freezes:

    <Window x:Class="WpfApplicationProgressTelerik.MainWindow"
            xmlns:local="clr-namespace:WpfApplicationProgressTelerik"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <Grid.Resources>
                <local:MyViewModel x:Key="MyViewModel" />
            </Grid.Resources>
            <StackPanel>
                <telerik:RadButton
                    Content="Click Me!"
                    DataContext="{StaticResource MyViewModel}"
                    Command="{Binding Command}" />
                <telerik:RadScheduleView
                    DataContext="{StaticResource MyViewModel}"
                    AppointmentsSource="{Binding Appointments}">
                    <telerik:RadScheduleView.ViewDefinitions>
                        <telerik:DayViewDefinition
                            MinorTickLength="{Binding DayViewDefinitionMinorTickLength}"
                            MajorTickLength="{Binding DayViewDefinitionMajorTickLength}" />
                        <telerik:WeekViewDefinition
                            MinorTickLength="{Binding WeekViewDefinitionMinorTickLength}"
                            MajorTickLength="{Binding WeekViewDefinitionMajorTickLength}" />
                        <telerik:TimelineViewDefinition
                            MajorTickLength="{Binding TimelineViewDefinitionMajorTickLength}"
                            MinorTickLength="{Binding TimelineViewDefinitionMinorTickLength}"
                            GroupTickLength="{Binding TimelineViewDefinitionGroupTickLength}" />
                    </telerik:RadScheduleView.ViewDefinitions>
                </telerik:RadScheduleView>
            </StackPanel>
        </Grid>
    </Window>

     

    using System;
    using System.Collections.ObjectModel;
    using System.Windows.Input;
    using Telerik.Windows.Controls;
    using Telerik.Windows.Controls.ScheduleView;
     
    namespace WpfApplicationProgressTelerik
    {
        internal class MyViewModel : ViewModelBase
        {
            private ObservableCollection<Appointment> appointments;
            public ObservableCollection<Appointment> Appointments
            {
                get
                {
                    if (this.appointments == null)
                    {
                        this.appointments = this.CreateAppointments();
                    }
                    return this.appointments;
                }
            }
     
            private ObservableCollection<Appointment> CreateAppointments()
            {
                var apps = new ObservableCollection<Appointment>();
     
                var app1 = new Appointment
                {
                    Subject = "Front-End Meeting",
                    Start = DateTime.Today.AddHours(9),
                    End = DateTime.Today.AddHours(10)
                };
                apps.Add(app1);
     
                var app2 = new Appointment
                {
                    Subject = "Planning Meeting",
                    Start = DateTime.Today.AddHours(11),
                    End = DateTime.Today.AddHours(12)
                };
                apps.Add(app2);
     
                return apps;
            }
     
            public ICommand Command { get; }
     
            public ITickProvider DayViewDefinitionMinorTickLength { get; private set; }
            public ITickProvider DayViewDefinitionMajorTickLength { get; private set; }
            public ITickProvider WeekViewDefinitionMinorTickLength { get; private set; }
            public ITickProvider WeekViewDefinitionMajorTickLength { get; private set; }
            public ITickProvider TimelineViewDefinitionMinorTickLength { get; private set; }
            public ITickProvider TimelineViewDefinitionMajorTickLength { get; private set; }
            public ITickProvider TimelineViewDefinitionGroupTickLength { get; private set; }
     
            internal MyViewModel()
            {
                Command = new DelegateCommand(SetTickProvider);
            }
     
            private void SetTickProvider(object obj)
            {
                DayViewDefinitionMinorTickLength = new FixedTickProvider(DateTimeInterval.Zero);
                DayViewDefinitionMajorTickLength = new FixedTickProvider(DateTimeInterval.Zero);
                WeekViewDefinitionMinorTickLength = new FixedTickProvider(DateTimeInterval.Zero);
                WeekViewDefinitionMajorTickLength = new FixedTickProvider(DateTimeInterval.Zero);
                TimelineViewDefinitionMinorTickLength = new FixedTickProvider(DateTimeInterval.Zero);
                TimelineViewDefinitionMajorTickLength = new FixedTickProvider(DateTimeInterval.Zero);
                TimelineViewDefinitionGroupTickLength = new FixedTickProvider(DateTimeInterval.Zero);
     
                OnPropertyChanged(nameof(DayViewDefinitionMinorTickLength)); //ContextSwitchDeadlock
                OnPropertyChanged(nameof(DayViewDefinitionMajorTickLength)); //System.OutOfMemoryException
                OnPropertyChanged(nameof(WeekViewDefinitionMinorTickLength)); //ContextSwitchDeadlock
                OnPropertyChanged(nameof(WeekViewDefinitionMajorTickLength)); //System.OutOfMemoryException
                OnPropertyChanged(nameof(TimelineViewDefinitionMinorTickLength)); //ContextSwitchDeadlock
                OnPropertyChanged(nameof(TimelineViewDefinitionMajorTickLength)); //System.OutOfMemoryException
                OnPropertyChanged(nameof(TimelineViewDefinitionGroupTickLength)); //System.OutOfMemoryException
            }
        }
    }

     

    In my opinion it would be helpful to immediately throw a System.ArgumentOutOfRangeException when setting an invalid (or even better when creating an invalid instance of) Telerik.Windows.Controls.ScheduleView.ITickProvider.

    What do you think?

    Best wishes!

  2. Stefan X1
    Admin
    Stefan X1 avatar
    698 posts

    Posted 22 Dec 2016 Link to this post

    Hi Christoph,

    Thank you for the valuable feedback.

    Indeed, it seems that an assurance from our end that the interval is not being set to zero would be an improvement of the control. I have logged this request  in our system for future implementation.

    I have also updated your Telerik points as a token of gratitude for your cooperation.

    All the best,
    Stefan X1
    Telerik by Progress
    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.
Back to Top