question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PlottableScatter.GetLimits() throws System.InvalidOperationException: Sequence contains no elements

See original GitHub issue

Describe the bug Provide a clear and concise description of what the bug is

Unhandled exception. System.InvalidOperationException: Sequence contains no elements at System.Linq.ThrowHelper.ThrowNoElementsException() at System.Linq.Enumerable.Min(IEnumerable`1 source) at ScottPlot.PlottableScatter.GetLimits() at ScottPlot.Settings.AxisAuto(Double horizontalMargin, Double verticalMargin, Boolean xExpandOnly, Boolean yExpandOnly, Boolean autoX, Boolean autoY) at ScottPlot.Plot.RenderBitmap() at ScottPlot.Plot.GetBitmap(Boolean renderFirst, Boolean lowQuality) at ScottPlot.WpfPlot.Render(Boolean skipIfCurrentlyRendering, Boolean lowQuality, Boolean recalculateLayout)

To Reproduce Describe what we can do to reproduce the behavior

// include code to help us reproduce this bug

Screenshots If applicable, add screenshots to help explain your problem

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
JagDTalcyoncommented, May 4, 2020

Thanks.

0reactions
grasmanek94commented, Jul 25, 2023

I think this happens when AutoSize / fit is specified, and the user zooms out or moves the render field outside of any visible data points, making Render try to render a null enumerable (no data points in view). Usually happens when I try to maximize or scroll/move and a .refresh call is being called at an unfortunate time.

I’m using beta v 5.0.6

Edit:

It was due to trusting the Destructor be called when being done with a plot (cleared data beforehand though, thinking it would call the destructor, it didn’t). Implemented the Disposable interface and now all works fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PlottableScatter.GetLimits() throws System. ...
System.InvalidOperationException: Sequence contains no elements at System.Linq. ... GetTotalPoints() to check and then render the plot.
Read more >
Handling 'Sequence has no elements' Exception [duplicate]
First() is causing this if your select returns 0 rows. You either have to catch that exception, or use FirstOrDefault() which will return ......
Read more >
Untitled
System.InvalidOperationException: Sequence contains more than one element at System. ... Stack Overflow "Xs must only contain ascending values" thrown at …
Read more >
InvalidOperationException Sequence contains no elements
InvalidOperationException : Sequence contains no elements at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) at Microsoft.
Read more >
Error when clicking Wooden Bookshelf, "Sequence ...
Every time I click it, I get a Error when clicking Wooden Bookshelf, "Sequence contains no elements" error. I was quite frustrated to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found