Skip to content

Fix database_size_stats tinyint cast error#471

Merged
erikdarlingdata merged 1 commit intodevfrom
fix/database-size-tinyint-cast
Mar 8, 2026
Merged

Fix database_size_stats tinyint cast error#471
erikdarlingdata merged 1 commit intodevfrom
fix/database-size-tinyint-cast

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

  • database_size_stats collector failing every cycle with InvalidCastException: Unable to cast object of type 'System.Byte' to type 'System.Int32'
  • sys.databases.compatibility_level is tinyint (System.Byte) but C# reader called GetInt32()
  • Fix: CONVERT(int, d.compatibility_level) in the on-prem SQL query

Test plan

  • Build clean
  • Launch Lite, verify database_size_stats collector runs without errors

🤖 Generated with Claude Code

sys.databases.compatibility_level is tinyint (System.Byte) but the
reader called GetInt32(). Add CONVERT(int, ...) in the SQL query to
match the expected C# type. This caused the collector to fail on
every cycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 35e90ca into dev Mar 8, 2026
@erikdarlingdata erikdarlingdata deleted the fix/database-size-tinyint-cast branch April 9, 2026 00:33
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