Prevent a crash while formatting a collection with nested empty collections#3150
Merged
dennisdoomen merged 1 commit intofluentassertions:support-7.0from Feb 7, 2026
Merged
Conversation
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
dec65d2 to
fa3e82a
Compare
dae635e to
dd9d95d
Compare
dd9d95d to
796e2db
Compare
Pull Request Test Coverage Report for Build 21785475175Details
💛 - Coveralls |
jnyrup
approved these changes
Feb 7, 2026
…llections - Prevents potential IndexOutOfRangeException in `FormattedObjectGraph` by using `Math.Min` for string insertion. - Improves formatting consistency of test expectations by removing unnecessary whitespace. - Adds a test to ensure rendering of empty nested collections does not crash.
796e2db to
b3de0ac
Compare
This was referenced Feb 7, 2026
Merged
This was referenced Mar 23, 2026
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.
This change hardens the object/collection formatter against a crash when it tries to splice a rendered fragment into an existing line but the calculated insertion index is past the end of the target string (now clamped to a valid range to avoid
IndexOutOfRangeException).The side-effect of this work is that spacing at the end of failure message is removed, which is something that was fix by the redesign of the formatting logic. For this hotfix, I had to take a less perfect approach.
Note This bug does not exist on v8 and can be discarded while upmerging.
Fixes #3148