I want to post a comment on in this answer: "Have you looked at the abandoned code now? So, what are you going to test?" indicating that it seems to me as soon as you add
<% if (Model.Thing == "abc") {} %>
or
@if (Model.Thing == "abc") {}
In your opinion, there is a potential for something to explode, and this potential must be protected.
Regarding the question I'm connected with, I could see the argument that you should avoid the possibility of eliminating a null reference exception in the code, and not hush up one view with null checks, but what about the case of partial representations? Would it really be better to add a few null checks in numerous places where a partial view can be displayed rather than one place in the view itself?
user74754
source share