Skip to content

System.InvalidOperationException: Sequence contains no elements when only dobule.NaN values are added to the LineSeries. #1991

@rlamp

Description

@rlamp

Steps to reproduce

  1. Add some double.NaN points to an empty line series (which is using smoothing).
  2. Crash.

Platform.
.NET version: .NET 6

Expected behaviour

The application should not crash, plot should stay unchanged.

Actual behaviour

The application crashes with the following exception and stack trace

System.InvalidOperationException: Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.Min[TSource](IEnumerable1 source, Func2 selector)
   at OxyPlot.Series.LineSeries.UpdateMaxMin() in C:\Users\Murdo\source\repos\oxyplot\Source\OxyPlot\Series\LineSeries.cs:line 426
   at OxyPlot.PlotModel.UpdateMaxMin(Boolean isDataUpdated) in C:\Users\Murdo\source\repos\oxyplot\Source\OxyPlot\PlotModel\PlotModel.cs:line 1171
   at OxyPlot.PlotModel.OxyPlot.IPlotModel.Update(Boolean updateData) in C:\Users\Murdo\source\repos\oxyplot\Source\OxyPlot\PlotModel\PlotModel.cs:line 801

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions