Blazor: How to fix System.NullReferenceException in _Host.cshtml file

I'm currently experimenting with Blazor, a Microsoft Web Framework, and the other day I encountered a strange error that took me a while to figure out how to fix. When running the Blazor Server App, I received the System.NullReferenceException: 'Object reference not set to an instance of an object.' exception error in Visual Studio inside the generated _Host.cshtml file.