Bad install of WPF?

Magnus Hiie reported an interesting problem that some of you may be hitting (thanks Magnus!).  He saw

System.Windows.Serialization.BamlParseException occurred
Message="Error at element 'StaticExtension' in markup file '' : Binary format of the specified custom attribute was invalid.."

on pretty much every xaml file he tried to load.  Problem is that the machine has an assembly in the GAC that can't be loaded, and WPF needs to look at every assembly in the GAC.  Assembly can't be read, so WPF chokes.  We'll work on making this a little more tolerant, but for now the solution is to remove whatever unreadable assembly is in your GAC.  You can figure out which assembly is causing the problem by breaking on first chance exceptions, call stack will look something like:

mscorlib.dll!System.Reflection.CustomAttributeData.GetCustomAttributes(System.Reflection.Module module = {Microsoft.BizTalk.KwTpm.StsBizTalkAdapter.dll} , int tkTarget) + 0x4f bytes 

As to why we're touching every assembly in the GAC -- we scan every assembly for XmlnsDefinitionAttribute so we know how to map XML namespaces into assemblies.  We cache it, so we don't need to do this every time a process launches, but we do need to read all the assemblies once.