Skip to content

fix: RendererSerializer.AddArrayProp obj cast NRE for struct arrays (int,double) - #324

Open
damyanpetev wants to merge 1 commit into
masterfrom
dpetev/combo-array-prop-fix
Open

fix: RendererSerializer.AddArrayProp obj cast NRE for struct arrays (int,double)#324
damyanpetev wants to merge 1 commit into
masterfrom
dpetev/combo-array-prop-fix

Conversation

@damyanpetev

Copy link
Copy Markdown
Member

Property value set with struct types (int, double) didn't work - RendererSerializer.AddArrayProp object cast fails for those values and produced null result which causes an immediate NullReferenceException after trying to access valuesArray.Length because the check is for the original param values.

This is reproducible by setting IgbCombo.Value to an array of such struct values, say int[] with ValueKey="Id" scenario.

I've updated the method to be generic and accept and enumerable instead so it can directly iterate over that. The null check is probably redundant, but CBA fixing everything in this class in one go :)

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • .NET version:
  • Hosting model:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code
  • This PR includes API docs for newly added methods/properties
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Closes #

@damyanpetev damyanpetev added 🐛 bug Something isn't working ❌ status: awaiting-test PRs awaiting manual verification combo labels Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes serialization of value-type arrays (e.g., int[], double[]) when sending array properties over the Ignite UI for Blazor renderer interop. It updates RendererSerializer.AddArrayProp to accept a generic IEnumerable<T> so it can iterate value-type arrays directly, and adds/updates a combo contract test to cover the scenario.

Changes:

  • Changed RendererSerializer.AddArrayProp from object + as object[] to a generic IEnumerable<T> implementation to avoid null/failed casts for struct arrays.
  • Updated combo interop contract tests to assert correct wiring of a keyed combo value using a value-type array (double[]).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/IgniteUI.Blazor.Tests/ComboTests.cs Adds a contract assertion that a keyed combo’s value array is transmitted as raw JSON numbers (covers value-type array serialization).
src/componentsBase/RendererSerializer.cs Makes AddArrayProp generic over IEnumerable<T> to correctly serialize struct arrays without relying on object[] casting.

Comment thread src/componentsBase/RendererSerializer.cs Outdated
@damyanpetev
damyanpetev force-pushed the dpetev/combo-array-prop-fix branch from b15b45d to aebd62c Compare August 7, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working combo ❌ status: awaiting-test PRs awaiting manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants