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"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
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!