fix: restore programmatic parameter loading in RdlViewer (issue #274)#278
Closed
majorsilence wants to merge 1 commit into
Closed
fix: restore programmatic parameter loading in RdlViewer (issue #274)#278majorsilence wants to merge 1 commit into
majorsilence wants to merge 1 commit into
Conversation
The GetParameters() method introduced in 5.0.19 preferred UserReportParameters.GetValueAsync() over the _Parameters dictionary. On initial load, the runtime cache is empty so GetValueAsync() returns null/default, and the merge skipped _Parameters values because the key was already present. This caused programmatically-set parameters to be silently ignored. Fix: - GetParameters(): check _Parameters first for each UserReportParameter; fall back to GetValueAsync() only when no explicit value is set - SetParameterValue(): initialize _Parameters if null (supports UI-only workflows) - ParametersTextValidated/ParametersLeave: also persist UI-entered values back to _Parameters so they survive subsequent Rebuild() calls - ParametersBuild: display _Parameters values in UI controls when set programmatically Co-authored-by: Peter Gill <majorsilence@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in RdlViewer where programmatically-provided report parameters (via viewer.Parameters / SetReportParameters*) could be silently ignored after the GetParameters() changes introduced in 5.0.19, restoring the intended precedence of explicitly set parameter values.
Changes:
- Updates
GetParameters()to prefer explicitly set_Parametersvalues over cached runtime parameter values. - Initializes
_Parameterson-demand and persists UI-entered parameter values back into_Parameters. - Pre-populates the parameter UI with
_Parametersvalues when available.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1697
to
+1701
| if (_Parameters != null && _Parameters.Contains(rp.Name)) | ||
| { | ||
| v.Text = _Parameters[rp.Name]?.ToString() ?? string.Empty; | ||
| } | ||
| else if (rp.DefaultValue != null) |
Comment on lines
1502
to
1505
| private async Task<IDictionary> GetParameters() | ||
| { | ||
| // If we have a loaded report with user parameters, use those runtime values | ||
| // instead of the _Parameters dictionary which may be stale | ||
| if (_Report != null && _Report.UserReportParameters != null && _Report.UserReportParameters.Count > 0) | ||
| { |
Comment on lines
+1509
to
+1519
| // Prefer explicitly-set _Parameters values over the runtime cache. | ||
| // _Parameters is populated programmatically and by UI interaction handlers, | ||
| // so it always reflects the most recent intended value. | ||
| if (_Parameters != null && _Parameters.Contains(urp.Name)) | ||
| { | ||
| runtimeParams[urp.Name] = _Parameters[urp.Name]; | ||
| } | ||
| else | ||
| { | ||
| runtimeParams[urp.Name] = await urp.GetValueAsync(); | ||
| } |
Owner
Author
|
superseded by #280 |
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.
Fixes #274
The
GetParameters()method introduced in 5.0.19 silently ignored programmatically-set parameters (viaviewer.ParametersorSetReportParameters*) due to incorrect merge priority.See issue for full analysis.
Generated with Claude Code