TextFormatFlags.ModifyString is obsolete

The TextFormatFlags.ModifyString field is obsolete, as a warning, and may be removed in a future .NET version.

Change description

In previous .NET versions, the TextFormatFlags.ModifyString enumeration field is not marked obsolete. In .NET 5 and later versions, it is marked obsolete as a warning. This field may be removed in a future .NET version.

Reason for change

Passing a string to TextRenderer.MeasureText with TextFormatFlags.ModifyString alters the string in some situations. This behavior breaks the string immutability promise and may lead to a fatal .NET runtime state corruption.

Version introduced

.NET 5.0

Update any code that relies on TextFormatFlags.ModifyString.

Affected APIs