Fixes StringBuilder unbounded size growth in Clear() when we use a mix of Append...
authorMaryam Ariyan <maryam.ariyan@microsoft.com>
Fri, 23 Mar 2018 16:29:55 +0000 (09:29 -0700)
committerDan Moseley <danmose@microsoft.com>
Fri, 23 Mar 2018 16:29:55 +0000 (09:29 -0700)
commit1ee83de5d83eec5362b4e335a326bfe816afa3a1
tree637476ee414ff28accc4af2ea752139218bf9717
parenta17fa337bb7ca7ecc5331195ff08a53da847bd14
Fixes StringBuilder unbounded size growth in Clear() when we use a mix of Append and Insert (#16926)

* Fixing Clear infinitely growing when we combine usage of Insert and Append. Fixes #27625

* Move debug code to StringBuilder.Debug.cs and Applied code review feedback

* Adding missing debug condition check

* Adding comments and moving Condition on projitems after filename

* Moving the infinite capacity growth fix to Length setter

* Removing originalCapacity and Debug.Assert

* Applying PR feedbacks

* Minor cleanup

* simplifying to single loop

* keeping just one method for ShowChunks function
src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
src/mscorlib/shared/System/Text/StringBuilder.Debug.cs [new file with mode: 0644]
src/mscorlib/shared/System/Text/StringBuilder.cs