Aspnetcore.docs: Sample HttpResponseException should be immutable.

Created on 16 Jul 2020  Â·  2Comments  Â·  Source: dotnet/AspNetCore.Docs

The sample HttpResponseException on this page is mutable. This is not a good programming practice, and we don't want customers to copy&paste antipatterns into their code:

public class HttpResponseException : Exception
{
    public int Status { get; set; } = 500;

    public object Value { get; set; }
}

Document Details

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

P0 Source - Docs.ms doc-bug needs-more-info

Most helpful comment

Lots of result types in MVC are mutable. Why is it considered a bad programming practice?

All 2 comments

@pranavkm please suggest how to fix this. See Use exceptions to modify the response

Lots of result types in MVC are mutable. Why is it considered a bad programming practice?

Was this page helpful?
0 / 5 - 0 ratings