Skip to content

Fix Issue with _stepCount Not Resetting, Causing Infinite Separator Exceptions - #1535

Closed
airtaxi wants to merge 1 commit into
Live-Charts:masterfrom
airtaxi:master
Closed

Fix Issue with _stepCount Not Resetting, Causing Infinite Separator Exceptions#1535
airtaxi wants to merge 1 commit into
Live-Charts:masterfrom
airtaxi:master

Conversation

@airtaxi

@airtaxi airtaxi commented Jun 25, 2024

Copy link
Copy Markdown

Description:

Problem

In the WinUI application, there was an issue where the _stepCount variable was not being reset, despite the UI not visibly exceeding 10,000 steps. Over time, _stepCount accumulated due to continuous use, which eventually triggered ThrowInfiniteSeparators() method calls.

Solution

To address this issue, I implemented a change where _stepCount is reset to 0 before each logic check that involves this variable.

Verification

Post-implementation, the change was tested by monitoring the application for extended periods. The fix proved effective, as the application no longer threw exceptions after approximately 10 minutes of uptime while showing graphs, a common occurrence prior to this update.

Related Issue

This fix also appears to resolve a similar issue reported in Issue #1076, further indicating the effectiveness of this solution.

Fixed an issue where _stepCount was not being reset, causing ThrowInfiniteSeparators() to be triggered as _stepCount accumulated over time, even though the actual step count did not exceed 10,000. (Live-Charts#1076 (comment))
Now, _stepCount is reset to 0 before each relevant logic check. This resolved the exception that occurred about 10 minutes after the chart was displayed.

@nadav26740 nadav26740 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have added _stepCount = 0; in every function that ends with

if (_stepCount++ > 10000) ThrowInfiniteSeparators();

so you could technically just completely remove

if (_stepCount++ > 10000) ThrowInfiniteSeparators();

at the end of functions Invalidate, GetPossibleMaxLabelSize, GetPossibleSize

@beto-rodriguez

Copy link
Copy Markdown
Collaborator

Thanks for the PR @airtaxi

I think this issue is already fixed with #1514, it will be published in the next version of the library.

@airtaxi

airtaxi commented Jul 22, 2024

Copy link
Copy Markdown
Author

@beto-rodriguez Thank you for letting me know that issue has already resolved!

I'm glad to hear that.

Therefore, I'm closeing this PR.

@airtaxi airtaxi closed this Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants