Skip to content

Conversation

@user-named-void
Copy link
Contributor

@user-named-void user-named-void commented Mar 5, 2025

With .NET9 casting the _values to an IList no longer results in a null value. This casts to an fixed size IList.
This results in an "Collection was of a fixed size" when trying to add a new item

When the list has a fixed size it will be recreated as a ScriptArray to fixed this, this fixes #585.

@xoofx
Copy link
Member

xoofx commented Mar 5, 2025

Could you add a small test to capture this use case and any future regressions?

@xoofx xoofx added the bug label Mar 5, 2025
@user-named-void
Copy link
Contributor Author

The Test "A400_builtins" already tests the array.add function and it fails without this patch if the test application is run under .net9. I don't know what other tests i should write.

…a new ScripArray if the list is of a fixed size
@xoofx xoofx force-pushed the fix_scriptrange.add branch from dfc3745 to 535c541 Compare March 6, 2025 09:48
@xoofx xoofx merged commit a404d9d into scriban:master Mar 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET9 ScriptRange Add NotSupportedException: Collection was of a fixed size

2 participants