We recently have issues in CSHTML Razor pages in ASP.NET Core (.NET Core 9) when it comes to the views, where we get a Dereference of a possibly null reference.message for accessing properties of a model, eventhough there es an explicit check if the Model is not null.
Mini-Sample
@model MyModel
@if (Model is not null)
{
<partial name="_MyPartial.cshtml" model="@Model.MySubProperty" />
}
Actual issue found by SonarQube
Version: SonarQube Server Enterprise v2025.3 (on prem / zip)