LiveCharts2
LiveCharts2 copied to clipboard
Fixing stuck _isInternalSet flag
Fixes three cases where logic can flag that internal changes are being made to ChartElement objects and escape the scope without reverting the _isInternalSet flag. I was actually encountering this on a project where I set the stroke color of a LineSeries based on a condition in the code. Due to the timing involved, there was a race condition where I was updating the stroke color after the CartesianChart escaped due to the empty bounds with the flag still set, preventing my change from ever being applied.
Personally, I think _isInternalSet should be wrapped in a disposable class that can be set in a using() context to ensure it never escapes the scope, even via exception. Additionally, it would ensure that this sort of escape could never happen again. If you're interested in such a change, let me know and I can make the necessary changes.
Thanks!