-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
This change removes support for formatting, parsing and conversions of bool-backed enum types. Bool-backed enum types are not expressible in C#. Formatting and parsing bool-backed enum types is never used in practice and complicates the implementation.
Version
.NET 8 Preview 1
Previous behavior
Formatting, parsing and conversations of bool-backed enum types has been somewhat functional.
New behavior
Formatting, parsing and conversations of bool-backed enum types throws InvalidOperationException
Type of breaking change
- Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
- Behavioral change: Existing binaries may behave differently at run time.
Reason for change
Removing the support for parsing and formatting bool-backed enum types makes .NET runtime simpler, faster and smaller minimal size.
Recommended action
Replace uses of bool-backed Enum type with regular bool type or byte-backed Enum type.
Feature area
Core .NET libraries
Affected APIs
Enum.Parse, Enum.TryParse, Enum.Format, Enum.GetName, Enum.GetNames, Enum.GetValues, Enum.ToObject