I'm a little late to this party, but for anyone who still has this issue I was able to work around it by disabling Copilot while editing .razor files. Not the most convenient solution, but works for me - hopefully whatever the real issue is will get fixed at some point.