So, here I am, 2 days later, having understood that the problem was entirely somewhere else.
In the same page, I have a Grid Component, where one of the GridColumns was defined as:
<GridColumn TItem="AnaAddressBooks" Context="chContext" HeaderText="@Localizer[LocalTranslations.Customers_AddressbookDefaultRole_Lbl]">
@if (chContext.FK_Cls_DefaultUserRole.Equals(ClsUsersRoles.OBSERVER)) {
<i class="fa-solid fa-binoculars"></i>
}
@if (chContext.FK_Cls_DefaultUserRole.Equals(ClsUsersRoles.SUBCONTRACTOR)) {
<i class="fa-solid fa-wrench"></i>
}
</GridColumn>
After commenting it out, I discovered that the error was disappearing.
Turns out, if I transformed the GridColumn like this:
<GridColumn TItem="AnaAddressBooks" Context="chContext" HeaderText="@Localizer[LocalTranslations.Customers_AddressbookDefaultRole_Lbl]" >
@if (chContext.FK_Cls_DefaultUserRole.Equals(ClsUsersRoles.OBSERVER)) {
<div>
<i class="fa-solid fa-binoculars"></i>
</div>
}
@if (chContext.FK_Cls_DefaultUserRole.Equals(ClsUsersRoles.SUBCONTRACTOR)) {
<div>
<i class="fa-solid fa-wrench"></i>
</div>
}
</GridColumn>
,embedding the two FontAwesome icons each in a div element, the error was gone.
Note that embedding the entire @if in a div, like this:
<GridColumn TItem="AnaAddressBooks" Context="chContext" HeaderText="@Localizer[LocalTranslations.Customers_AddressbookDefaultRole_Lbl]">
<div>
@if (chContext.FK_Cls_DefaultUserRole.Equals(ClsUsersRoles.OBSERVER)) {
<i class="fa-solid fa-binoculars"></i>
}
@if (chContext.FK_Cls_DefaultUserRole.Equals(ClsUsersRoles.SUBCONTRACTOR)) {
<i class="fa-solid fa-wrench"></i>
}
</div>
</GridColumn>
still wouldn't work and would give the same error.
Edit: In the end I was partially inspired by this StackOverflow thread that featured a similar error