Despite the confusing output information, it seems the issue was simply a missing using (using Microsoft.AspNetCore.Components;), which wasn't being caught because of the way the compilation was working before. Possibly an IDE bug?
using
using Microsoft.AspNetCore.Components;