Fix potential bug with array formula loading not setting all shared strings #2609
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.
While looking through the ClosedXML source code to understand how array formulas work, I came across this bit of code that looked not quite right. It looks like when loading a workbook, array formula loading iterates through all the cells referenced by the array formula to set the shared strings, but instead of setting it for each cell, it currently appears to just set the master cell over and over again.
It looks like this change happened in commit e49fef9 when setting formulas was changed to using slices, but maybe a copy-paste mistake missed a required cell address change.
I am definitely not yet familiar with how array formulas work under the hood though, so I might be off base here. Iterating but not changing the call just looked suss to me