GearedExamples icon indicating copy to clipboard operation
GearedExamples copied to clipboard

Exception "Specified argument was out of the range of valid values."

Open NKitsak opened this issue 4 years ago • 2 comments

I received exception ArgumentOutOfRangeException during the tests. It happens very often. It is impossible to use LiveCharts.Geared library. Can somebody help with this issue? Possible I can use some workaround except do not use it?

StackTrace: at MS.Utility.FrugalStructList`1.Insert(Int32 index, T value) at System.Windows.Media.PathSegmentCollection.Insert(Int32 index, PathSegment value) at LiveCharts.Wpf.Points.HorizontalBezierPointView.DrawOrMove(ChartPoint previousDrawn, ChartPoint current, Int32 index, ChartCore chart) at LiveCharts.SeriesAlgorithms.LineAlgorithm.Update() at LiveCharts.ChartUpdater.Update(Boolean restartsAnimations, Boolean force) at LiveCharts.Wpf.Components.ChartUpdater.UpdaterTick(Boolean restartView, Boolean force) at LiveCharts.Wpf.Components.ChartUpdater.OnTimerOnTick(Object sender, EventArgs args) at System.Windows.Threading.DispatcherTimer.FireTick(Object unused) 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.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext 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 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.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run() at LiveChartsIssue.App.Main()

xaml file <lvc:CartesianChart Series="{Binding SeriesCollection}" LegendLocation="None" DisableAnimations="True" Zoom="X"> lvc:CartesianChart.AxisY <lvc:Axis Title="Temperature" LabelFormatter="{Binding YFormatter}" MinValue="-180" MaxValue="180"/> </lvc:CartesianChart.AxisY> lvc:CartesianChart.AxisX <lvc:Axis Title="X" MaxValue="1639750097.5839999" MinValue="1639750087.553"/> </lvc:CartesianChart.AxisX> </lvc:CartesianChart>

xaml.cs file public partial class MainWindow : Window { public MainWindow() { InitializeComponent();

    SeriesCollection = new SeriesCollection
    {
        new LineSeries
        {
            Title = "Y",
            Values = new GearedValues<Point>
            {
                new Point(1639750087.553, -10.603858259871348),
                new Point(1639750089.129, -10.576060238940023),
                new Point(1639750089.12, -14.77816173293736),
                new Point(1639750097.5839999, -10.853805873381631),
            },
            LineSmoothness = 0,
            Configuration = Mappers.Xy<Point>().X(el=>el.X).Y(el => el.Y)
        }
    };
    
    YFormatter = value => value.ToString("F1");

    DataContext = this;
}

public SeriesCollection SeriesCollection { get; set; }

public Func<double, string> YFormatter { get; set; }

}

Package References LiveCharts.Geared Version 1.2.9 LiveCharts.Wpf Version 0.9.7

NKitsak avatar Dec 28 '21 11:12 NKitsak

I get the same exact exception, which crashes my application

SmackyPappelroy avatar Aug 29 '23 13:08 SmackyPappelroy