KEMBAR78
[Breaking change]: Remove support for parsing, formatting and conversions of bool-backed Enum types · Issue #33647 · dotnet/docs · GitHub
Skip to content

[Breaking change]: Remove support for parsing, formatting and conversions of bool-backed Enum types #33647

@jkotas

Description

@jkotas

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


Associated WorkItem - 118223

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 8Work items for the .NET 8 release📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions