This is very strange.
I have an XAML file that looks as follows...
So simple, but so easy to overlook: MainWindow's x:Class was set to "MainWindow", when it should have been set to namespace.MainWindow (x:Class="namespace.MainWindow"). If this is not done, then the MainWindow.g.xaml file will not include a namespace block, and the call to InitializeComponent() in MainWindow's constructor will not work.
Although this obviously isn't a solution to willem's problem, I posted it here because there are so many other solutions listed. Hopefully this will help someone else who stumbles on this post when trying to fix their problem.