Skip to content

Fix crosshair crash on out-of-range hover (FromOADate)#1087

Merged
erikdarlingdata merged 1 commit into
devfrom
fix/crosshair-oadate
Jun 9, 2026
Merged

Fix crosshair crash on out-of-range hover (FromOADate)#1087
erikdarlingdata merged 1 commit into
devfrom
fix/crosshair-oadate

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

Problem

CorrelatedCrosshairManager.OnMouseMove feeds the raw mouse X-coordinate straight into DateTime.FromOADate(xValue) with no bounds check. FromOADate throws ArgumentException: "Not a legal OleAut date" for any value outside year 0100–9999 (the double range -657435.0 … 2958466.0).

Hovering past the plotted data — or over a chart whose axis is auto-scaled wide/empty — produces a coordinate outside that range and crashes. Because this handler (unlike ChartHoverHelper) has no try/catch, the exception escapes to the dispatcher handler and surfaces a modal "An error occurred… Not a legal OleAut date" dialog.

Fix

Guard xValue against NaN and the legal OADate range immediately after it's computed, and bail out of the crosshair update rather than throwing. One 7-line guard; no behavior change for in-range hovers.

The other two FromOADate call sites (ChartHoverHelper.cs:143/225) are already safe — they convert a real plotted-data-point X and are wrapped in try/catch.

Notes

🤖 Generated with Claude Code

CorrelatedCrosshairManager.OnMouseMove fed the raw mouse X-coordinate straight into DateTime.FromOADate, which throws ArgumentException ("Not a legal OleAut date") for any value outside year 0100-9999. Hovering past the plotted data, or over an empty/auto-scaled chart, can produce such a coordinate and surfaces a modal error dialog (the handler has no try/catch, unlike ChartHoverHelper). Guard xValue against NaN and the legal OADate range and bail out of the crosshair update instead of crashing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 3004090 into dev Jun 9, 2026
2 checks passed
@erikdarlingdata erikdarlingdata deleted the fix/crosshair-oadate branch June 9, 2026 21:55
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.

1 participant