Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/libraries/System.Private.CoreLib/src/System/String.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ private static unsafe string Ctor(ReadOnlySpan<char> value)
public static string Create<TState>(int length, TState state, SpanAction<char, TState> action)
where TState : allows ref struct
{
// To support interop scenarios, the underlying buffer is guaranteed to be at least 1 greater than represented by the span parameter of the action callback.
// This additional index represents the null-terminator and, if written, that is the only value supported.
// Writing any value other than the null-terminator corrupts the string and is considered undefined behavior.

if (action is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.action);
Expand Down
Loading