PlaybackWpfUserControl crashes

Can be reproduced with PlaybackWpfUser sample. Steps to reproduce:

1. Press left mouse button on ImageViewerWpfControl.

2. Hold the button and drag the mouse over to PlaybackWPUserControl timeline.

3. Release the button.

This crash only occurs if the timeline of playback control wasn’t dragged.

Using 2017 R3 or 2018 R1.

Unhandled Exception: System.ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime.

Parameter name: t

at System.DateTime.op_Addition(DateTime d, TimeSpan t)

at VideoOS.Platform.Client.PlaybackWpfUserControlMini.OnMouseUp(MouseButtonEventArgs e)

at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)

at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)

at System.Windows.Input.InputManager.ProcessStagingArea()

at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)

at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)

at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)

at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at System.Windows.Interop.HwndSource.InputFilterMessage(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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(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.RunDispatcher(Object ignore)

at System.Windows.Application.RunInternal(Window window)

at PlaybackWpfUser.App.Main() in [C:\Program](file:C:/Program) Files\Milestone\MIPSDK\ComponentSamples\PlaybackWpfUser\App.xaml.cs:line 27

we will take a look at it, our internal bug id: 165571

Hi Anders,

I am facing the same problem.Please find the log and code details below.

Error Message :The added or subtracted value results in an un-representable DateTime.\r\nParameter name: t

at System.DateTime.op_Subtraction(DateTime d, TimeSpan t)

at VideoOS.Platform.Client.PlaybackWpfUserControlMini.UpdateUiDateTime(DateTime _newTime)

at VideoOS.Platform.Client.PlaybackWpfUserControlMini.UpdateUiTimeLine(DateTime _newCenter)

at VideoOS.Platform.Client.PlaybackWpfUserControlMini.Refresh()

at VideoOS.Platform.Client.PlaybackWpfUserControlMini.SetEnabled(Boolean enable)

at VideoOS.Platform.Client.PlaybackWpfUserControl.SetEnabled(Boolean enable)

at WpfMilestonePlayBack.MileStonePlaybackWindow.EnablePlayback() in [e:\Milestone2018\WpfMilestonePlayBack\MileStonePlaybackWindow.xaml.cs](file:e:/Milestone2018/WpfMilestonePlayBack/MileStonePlaybackWindow.xaml.cs):line 226

MyCode:

private void EnablePlayback()

{

  if (true)

  {         

    \_playbackUserControl.Visibility = Visibility.Visible;

    try

    {

      \_playbackUserControl.ShowTallUserControl = true;

      \_playbackUserControl.ShowSpeedControl = true;

      \_playbackUserControl.ShowTimeSpanControl = true;

      \_playbackUserControl.SelectionFromTime = TempTimeStamp.Date;

      \_playbackUserControl.SelectionToTime = TempTimeStamp.AddDays(1).Date;

      \_playbackUserControl.TimeSpan = new TimeSpan(0, 1, 0);

      \_playbackUserControl.SetSequence(TempTimeStamp.

        TimeStamp.Subtract(new TimeSpan(0, 0, 30)), TempTimeStamp.AddSeconds(60));

      \_playbackUserControl.SetEnabled(true);

      \_imageViewerControl.StartBrowse();

      EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(

                            VideoOS.Platform.Messaging.MessageId.System.ModeChangeCommand,

                            Mode.ClientPlayback), \_playbackFQID);           

      Console.WriteLine("Done.");

    }

    catch (Exception e1)

    {

      Console.WriteLine("Error:" + e1.Message);

    }

  }

}

@Ashwin Amarapuram Chandramouly​ We can not reproduce the error that you reported. I assume that you TempTimeStamp is set as minimum value and subtraction on that value gives you that error. Furthermore, SelectionFromTime and SelectionToTime properties are not supported for standalone playbackUserControl. You can find that information in the SDK documentation.