When asp-if evaluates to false, the content is still generated, and suppressed after
See original GitHub issueSay we invoke a partial view such as:
<partial name="_PersonSummary" model="Model.PersonSummaryInfo" asp-if="Model.PersonSummaryInfo is not null" />
The partial view assumes that its supplied model is not null, so a null reference exception happens if it’s invoked when PersonSummaryInfo is null. A standard @if
block around the <partial>
prevents that, but asp-if doesn’t because the partial is still invoked.
Please close the issue if this is expected behaviour or if there’s no way around it other than sticking with an @if
block, or changing the partial to cope with a null model.
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Why there is no deep dornish masterplan : r/asoiaf
Even in his supposedly most badass moment, he still sounds weak. Is it a surprise that his plan goes horribly wrong later? That's...
Read more >Recovery Time of Platelet Function After Aspirin Withdrawal
The platelet function was gradually normalized 72 hours after drug withdrawal. This suppression was consistent with the results reported for ...
Read more >Chapter-by-Chapter Analysis: Tyrion V, ACOK
When trying to evaluate how good a job Tyrion's doing as Hand, I think we have to acknowledge that (unlike his father) he...
Read more >Alas, poor Wallace: A Review of Infinite Jest | Three Pound Brain
[3] It makes no more sense reviewing a novel absent its particular communicative context than it does evaluating conversations with your mom, ...
Read more >How to Build Your Own ASP-based System?!
Answer Set Programming, or ASP for short, has become a popular and sophisticated approach to declarative problem solving.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@DamianEdwards Works a treat thanks.
Updated the tag helpers defined in my own codebase to set the Order and use the SuppressedByAspIf extension method in line with this change. So it’s handy you made that public 😄
OK it should up shortly at https://www.nuget.org/packages/TagHelperPack/0.9.0-pre-20221214.35