Ever since the November 2005 CTP of WinFX I have had trouble running any Windows Presentation Foundation (WPF) sample application on my machine. Every WPF program would crash on startup with weird BAML related exceptions. Even freshly created WPF programs in Visual Studio 2005 with a single empty form refused to run. I wasn't able to find a solution at the time.
Last week Microsoft released the January 2006 CTP together with the first public release of Microsoft Expression Interactive Designer aka "Sparkle". Guess what, "Sparkle" crashed on startup on my machine as well. That was to be expected, since "Sparkle" is a 100% WPF managed code application.
Because I saw great demos of this "Avalon" design tool at PDC05, I badly wanted to be able to run this application. So I had to invest some time in fixing my problems.
Luckily, our ASP.NET 2.0 application for Windows Media Center is done. After two months of hard work I have time to look into WinFX again. Expect more details about that Media Center project as soon as it goes live. Well it is semi-live already, meaning you can access it on the Internet if you know the URL, but I cannot divulge that information just yet.
This time Google led me to this blog entry by Nick Kramer. Nick describes that WPF scans every assembly in the Global Assembly Cache (GAC) and chokes if it cannot read one of those assemblies. The troublemaker on my machine turned out to be the Microsoft Enterprise Instrumentation Framework. It tries to load the .NET 1.0 version of System.Management, which I don't have installed on my machine. Removing Enterprise Instrumentation fixed my problem.
So I can finally run WPF applications again.