Skip to content

Configuration option to treat checked context as the default instead of unchecked #3483

@ds5678

Description

@ds5678

Is your feature request related to a problem?

In most of my projects, I enable <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> for the extra safety, which makes operators use their checked variants. This configuration option would make decompiled output closer to what I would write.

Describe the solution you'd like

I haven't looked into the implementation details, but I know ILSpy has some context tracking for whether operations are currently happening in checked or unchecked context. I assume it should be fairly simple to switch which one is used "globally."

Additional context

I'm unsure how to make the compiler use a build property like CheckForOverflowUnderflow for the pretty test.

As with all my issues, I'm willing to contribute an implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions