-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The StringBuilder.Append(Char[], Int32, Int32) method call throws the System.ArgumentOutOfRange exception in a valid situation when the app targets .NET 8 and built in the Release configuration #96839
Comments
Tagging subscribers to this area: @dotnet/area-system-runtime Issue DetailsDescriptionHi, We use a similar code in one of the DevExpress products and our customer stumbled upon an exception being thrown once they updated their project to .NET 8. The exception occurs when the `static char[] Digits = new char[10] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
Reproduction StepsUse the code snippet above or the attached sample to reproduce the issue in an app built for AnyCPU/x64, .NET 8, in the Release mode. Expected behaviorThe exception is not thrown on the latest step of the loop. Actual behaviorThe exception is thrown on the latest step of the loop. Regression?Yes, this did work as expected in .NET 7 (tested on 7.0.14) and in .NET Framework. Known WorkaroundsNo response Configuration
Other informationNo response
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsDescriptionHi, We use a similar code in one of the DevExpress products and our customer stumbled upon an exception being thrown once they updated their project to .NET 8. The exception occurs when the `static char[] Digits = new char[10] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
Reproduction StepsUse the code snippet above or the attached sample to reproduce the issue in an app built for AnyCPU/x64, .NET 8, in the Release mode. Expected behaviorThe exception is not thrown on the latest step of the loop. Actual behaviorThe exception is thrown on the latest step of the loop. Regression?Yes, this did work as expected in .NET 7 (tested on 7.0.14) and in .NET Framework. Known WorkaroundsNo response Configuration
Other informationNo response
|
Thanks for the great minimized test case! I am able to reproduce the issue even on main. It does not repro with |
It does repro with |
it doesn't repro on Main (9.0) 🤔 |
@jakobbotsch identified #100848 as a fix for this issue. it was recently backported to 8.0 so I guess we can close it |
Description
Hi,
We use a similar code in one of the DevExpress products and our customer stumbled upon an exception being thrown once they updated their project to .NET 8. The exception occurs when the
stringBuilder.Append(array, array.Length - 2, 2);
line of code is executed within a loop on the 10000th step and only in the Release configuration. We suppose that this might occur due to the some optimizations performed at a compile time in the Release mode.WinFormsApp7.zip
Reproduction Steps
Use the code snippet above or the attached sample to reproduce the issue in an app built for AnyCPU/x64, .NET 8, in the Release mode.
Expected behavior
The exception is not thrown on the latest step of the loop.
Actual behavior
The exception is thrown on the latest step of the loop.
Regression?
Yes, this did work as expected in .NET 7 (tested on 7.0.14) and in .NET Framework.
Known Workarounds
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: