ScheduleView NullReferenceException when changing the view

4 posts, 0 answers
  1. Alex
    Alex avatar
    1 posts
    Member since:
    Jul 2012

    Posted 02 Jul 2012 Link to this post

    Hi.

    I have a problem with the ScheduleView.  When changing the view from Month to Day, i get a NullReferenceException.

    I've attached a sample.

    Steps to reproduce the problem :
    * run the sample
    * expand the cell filled with data
    * switch the view to Day

    I get a NullReferenceException at that point.

    The stack trace is :
      
    at Telerik.Windows.Controls.GroupHeader.InitializeColumnsAndUpdateMaxIntersectedAppointmentsCount()
       at Telerik.Windows.Controls.GroupHeader.Initialize()
       at Telerik.Windows.Controls.AppointmentsPanel.AddHeaders(GroupHeader header, Boolean isHorizontal, Boolean showWeekHeaders, Calendar calendar, CalendarWeekRule weekRule, DayOfWeek firstDayOfWeek)
       at Telerik.Windows.Controls.AppointmentsPanel.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
    (...)

    The xaml i used is :

    <Window x:Class="scheduleViewError.MainWindow"
            xmlns:scheduleView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.ScheduleView"
            Title="MainWindow" Height="350" Width="525">
         
        <Grid>
     
            <telerik:RadScheduleView x:Name="scheduleview" Grid.Row="2" Grid.Column="2" Margin="0"
                                     AppointmentsSource="{Binding Appointments}"
                                     BorderThickness="0 1 1 1"
                                     FirstVisibleTime="06:00">
     
             
                <telerik:RadScheduleView.ViewDefinitions>
                    <telerik:MonthViewDefinition />
                    <telerik:DayViewDefinition />
                </telerik:RadScheduleView.ViewDefinitions>
            </telerik:RadScheduleView>
        </Grid>
     
    </Window>

    the code-behind is :

    public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                this.DataContext = new ViewModel();
            }
        }
     
    public class ViewModel
        {
            private ObservableAppointmentCollection _apppointments;
     
     
            public ViewModel()
            {
                var today = DateTime.Today;
     
                var x = new ObservableCollection<Appointment>(Enumerable.Range(9, 14).Select(i =>
                    new Appointment
                    {
                        Start = today.AddMinutes(i * 60 + 15),
                        End = today.AddMinutes((i + 1) * 60),
                        Subject = string.Format("Appointment num. {0}", i),
                    }));
     
                _apppointments = new ObservableAppointmentCollection();
                _apppointments.AddRange(x);
     
            }
     
            public ObservableAppointmentCollection Appointments
            {
                get
                {
                    return _apppointments;
                }
                set
                {
                    if (_apppointments == value)
                        return;
                    _apppointments = value;
                }
            }
     
        }


    I used the 2012.2.607.40 version of the library with .Net Framework 4.0.

  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 03 Jul 2012 Link to this post

    Hello Alex,

    I tried to reproduce the issue with the code from your project but with no success.

    Can you give us more details on the exact scenario when the issue occurs?

    Kind regards,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Lucian Iacobescu
    Lucian Iacobescu avatar
    1 posts
    Member since:
    Nov 2006

    Posted 03 Jul 2012 Link to this post

    Hi Vladi.

    Thanks for your prompt reply.

    My operating system is Windows 7 Ultimate, 64. I tried installing the latest Telerik WPF controls and did a new solution with the code i already linked, and the error occurred.

    Please make sure to first expand the cell containing the appointments and then switch the view with the cell expanded.

    I tried the same code on a colleague's computer and the error appeared there as well.

    When expanding the cell i get a first exception :
    System.ArgumentException occurred
      Message=Value does not fall within the expected range.
      Source=mscorlib
      StackTrace:
           at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
           at MS.Internal.Automation.UiaCoreProviderApi.CheckError(Int32 hr)
           at System.Windows.Automation.Peers.AutomationPeer.RaisePropertyChangedEvent(AutomationProperty property, Object oldValue, Object newValue)
           at Telerik.Windows.Controls.AutomationPeerHalper.RaiseAutomationPropertyChanged(FrameworkElement target, AutomationProperty property, Object oldValue, Object newValue) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\AutomationPeer\AutomationPeerHelper.cs:line 46
      InnerException:

    which is handled.
    When i then switch the view i get the crash exception :
    System.NullReferenceException was unhandled
      Message=Object reference not set to an instance of an object.
      Source=Telerik.Windows.Controls.ScheduleView
      StackTrace:
           at Telerik.Windows.Controls.GroupHeader.InitializeColumnsAndUpdateMaxIntersectedAppointmentsCount() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\GroupHeader.cs:line 776
           at Telerik.Windows.Controls.GroupHeader.Initialize() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\GroupHeader.cs:line 373
           at Telerik.Windows.Controls.AppointmentsPanel.AddHeaders(GroupHeader header, Boolean isHorizontal, Boolean showWeekHeaders, Calendar calendar, CalendarWeekRule weekRule, DayOfWeek firstDayOfWeek) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\AppointmentsPanel.cs:line 1045
           at Telerik.Windows.Controls.AppointmentsPanel.MeasureOverride(Size availableSize) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\ScheduleView\ScheduleView\Controls\AppointmentsPanel.cs:line 360
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
           at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
           at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
           at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           at System.Windows.UIElement.Measure(Size availableSize)
           at System.Windows.ContextLayoutManager.UpdateLayout()
           at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
           at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
           at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
           at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
           at System.Threading.ExecutionContext.runTryCode(Object userData)
           at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Windows.Threading.DispatcherOperation.Invoke()
           at System.Windows.Threading.Dispatcher.ProcessQueue()
           at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
           at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
           at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
           at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
           at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
           at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
           at System.Windows.Application.RunInternal(Window window)
           at System.Windows.Application.Run()
           at TelerikBugTEst.App.Main() in C:\Various\TelerikBugTEst\TelerikBugTEst\obj\x86\Debug\App.g.cs:line 0
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:
  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 04 Jul 2012 Link to this post

    Hello Dragos,

    We are still unable to reproduce the issue. I have recorded a video showing that no exception is being thrown.

    Please let us know if we are missing something.

     Looking forward to your answer.

    Kind regards,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top