Fix crash when adding Table/Chart/Matrix to a report with no datasets#269
Merged
majorsilence merged 2 commits intomasterfrom Feb 24, 2026
Merged
Fix crash when adding Table/Chart/Matrix to a report with no datasets#269majorsilence merged 2 commits intomasterfrom
majorsilence merged 2 commits intomasterfrom
Conversation
Co-authored-by: majorsilence <656288+majorsilence@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix invalid argument error when creating a report
Fix crash when adding Table/Chart/Matrix to a report with no datasets
Feb 22, 2026
majorsilence
approved these changes
Feb 24, 2026
There was a problem hiding this comment.
Pull request overview
This pull request fixes a crash that occurs when opening Table, Chart, or Matrix dialogs on reports with no datasets defined. The issue is caused by unconditionally setting SelectedIndex = 0 on an empty ComboBox, which throws an ArgumentException.
Changes:
- Added defensive guards to check
Items.Count > 0before settingSelectedIndex = 0in three dialog initialization methods - The fix prevents the crash while maintaining correct behavior when datasets are present
- The pattern used matches existing conventions in the codebase (e.g.,
DialogDataSources,ReportParameterCtl)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| RdlDesign/DialogNewTable.cs | Added guard to prevent setting SelectedIndex on empty cbDataSets ComboBox |
| RdlDesign/DialogNewMatrix.cs | Added guard to prevent setting SelectedIndex on empty cbDataSets ComboBox |
| RdlDesign/DialogNewChart.cs | Added guard to prevent setting SelectedIndex on empty cbDataSets ComboBox |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening a Table, Chart, or Matrix dialog on an empty report (no datasets defined) throws an unhandled
ArgumentExceptionbecausecbDataSets.SelectedIndex = 0is called unconditionally on an empty ComboBox.Changes
DialogNewTable.cs,DialogNewChart.cs,DialogNewMatrix.cs: GuardSelectedIndexassignment with an item count check in each dialog's constructor.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.