Fix #8614 for regression #8610 introduced by #8212 never made it into 17.6: https://github.com/dotnet/razor/commits/release/dev17.6 (but the regression itself did).
Note: there's another regression both in 17.6 and 17.7 caused by the same PR: #8718