Skip to content

Exception with required property #22046

Open
@Mikejo5000

Description

@Mikejo5000

Moved issue to .NET
Old issue: https://github.com/MicrosoftDocs/visualstudio-docs/issues/3228, opened by @motz-art

For full discussion of issue, see 3228.

Hi,

I would like to suggest an enhancement for case when Exception must have some properties initialized.

Documentation says that "Failure to provide the full set of constructors can make it difficult to correctly handle exceptions.". Is it fine to Suppress the warning in this case when next constructors provided: CustomException(RequiredData), CustomException(RequiredData, string), CustomException(RequiredData, string, Exception)?

So having CustomException(RequiredData, string, Exception) would still allow me to create custom exception and specify that it's caused by another exception.

If it's not fine to suppress, please explain why and what is the best practice?

Thank you


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

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