You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Full Dashboard (deprecated): Trace Flag Changes grid throws InvalidCastException now that the view returns rows #1660
Found by the issue audit as a follow-up to #1635. The fix there was correct and the reporter's scenario is genuinely resolved — this is the next failure it exposed, not a regression of it.
What happens
config.trace_flags_history.status is bit NOT NULL (install/03_create_config_tables.sql:430), and report.trace_flag_changes projects it through untouched:
deprecated/Dashboard/Models/TraceFlagChangeItem.cs:12-13 — both declared string
SqlDataReader.GetString performs no conversion and throws InvalidCastException on a bit column.
Why it only surfaces now
Before #1635, the view itself failed with Msg 245 the moment a toggle row flowed through it, so the reader never got to run. Now that the view returns rows, execution reaches the cast and fails there instead. Affected surfaces: the Dashboard's Trace Flag Changes grid and the get_trace_flag_changes MCP tool, which share that method (deprecated/Dashboard/Mcp/McpConfigHistoryTools.cs:129).
Direct SQL consumers of the view — including the Grafana companion @argpna was building — are unaffected and correctly fixed.
Suggested fix
Change the reader, not the view: read the bit and format it C#-side.
The view's column shape is a public contract for anyone querying report.trace_flag_changes directly, and someone is already doing exactly that. Converting the columns to 'ON'/'OFF' text in SQL would fix the Dashboard while silently breaking those external queries — the wrong trade.
Scope: deprecated, bug-fix-only, and not shipped in release artifacts, so low priority. Lite and Darling are unaffected; they diff trace flags in C# via the shared PerformanceMonitor.Common.ConfigChangeDiff and never touch this view.
Related: a CI blind spot worth its own look
Nothing would have caught this. .github/sql/ci_validate_installation.sql:128 validates report.* views by OBJECT_ID existence only and never selects from them, so an entire bug class — view compiles and exists, but throws or mistypes on execution — is invisible to CI. #1635 was itself exactly that class, reported by a user rather than caught by a build.
Correcting the CI note I left on this issue, because I tested it and I was wrong.
I claimed a smoke SELECT TOP (1) per report.* view would close this blind spot. It would not. Tested on SQL Server 2022 against a minimal reproduction of this bug class (a bit column compared to N'OFF' inside a view):
SELECT TOP (0) on an empty table — passes silently
SELECT TOP (1) on an empty table — passes silently
SELECT TOP (1) with one row present — Msg 245, caught
CI validates a fresh install, so every collector table is empty and the conversion never executes. A smoke select would only catch compile/bind-class breakage (a view referencing a renamed or dropped column), not row-dependent conversion errors like this one. Closing the real gap needs representative seeded rows across all 43 views.
And that is not worth building. These views live in install/, which serves the retired Full Dashboard — bug-fix-only, no longer in release artifacts. Investing in new CI infrastructure to protect it is the wrong trade, especially when the cheap version demonstrably does not work.
So: this remains a known, accepted gap for the deprecated SQL surface. Recording it accurately rather than half-closing it with a check that would have created false confidence.
Nothing changes about the defect this issue tracks — the GetString on a bit column at deprecated/Dashboard/Services/DatabaseService.SystemEvents.cs:469-470 is still real and still unfixed.
Activity
erikdarlingdata commentedon Jul 26, 2026
Correcting the CI note I left on this issue, because I tested it and I was wrong.
I claimed a smoke
SELECT TOP (1)perreport.*view would close this blind spot. It would not. Tested on SQL Server 2022 against a minimal reproduction of this bug class (abitcolumn compared toN'OFF'inside a view):SELECT TOP (0)on an empty table — passes silentlySELECT TOP (1)on an empty table — passes silentlySELECT TOP (1)with one row present — Msg 245, caughtCI validates a fresh install, so every collector table is empty and the conversion never executes. A smoke select would only catch compile/bind-class breakage (a view referencing a renamed or dropped column), not row-dependent conversion errors like this one. Closing the real gap needs representative seeded rows across all 43 views.
And that is not worth building. These views live in
install/, which serves the retired Full Dashboard — bug-fix-only, no longer in release artifacts. Investing in new CI infrastructure to protect it is the wrong trade, especially when the cheap version demonstrably does not work.So: this remains a known, accepted gap for the deprecated SQL surface. Recording it accurately rather than half-closing it with a check that would have created false confidence.
Nothing changes about the defect this issue tracks — the
GetStringon abitcolumn atdeprecated/Dashboard/Services/DatabaseService.SystemEvents.cs:469-470is still real and still unfixed.Merge pull request #1668 from erikdarlingdata/feature/1660-traceflag-…
erikdarlingdata commentedon Jul 26, 2026
Fixed by PR #1668, merged to dev. Live on DARLING01 as of the dev@f899fe94 deploy (2026-07-26).
Dashboard: read trace-flag status bits as bits, format ON/OFF reader-…