XamlParserException - AG_E_PARSER_BAD_TYPE

By admin on Nov 14 2008 | 1 Comments

Ohhhhh the dreaded XamlParserException. The exception message is not to helpful at all.

In my instance I was working with Silverlight. Namely working with the Prism  V2 Drop #5 from the Composite WPF team. Get the latest and read up the project here. I was loading the TreeView control into my view (Xaml) and when the app fired up the project would bomb with this exception and the message was VERY informative *sarcasm*.

AG_E_PARSER_BAD_TYPE

Hmm... Ok. Sure. Sounds good.

I have my projects laid out like so.

image

 

The Prism Shell (Top) loads different modules at runtime. Module A has a view (View 1) which has a tree view. Therefore, Module A (which is a Silverlight App itself) references the Microsoft.Windows.Controls library which contains the new controls for Silverlight (download them here). When this was getting compiled and referenced at runtime, the Microsoft.Windows.Controls dll was not in the Shell project, therefore it would blow up when it tried to parse the Xaml. Giving me the lovelly and dreaded XamlParserException.

The Fix

Simple. Add a reference to the Microsoft.Windows.Controls dll in the main Prism App. Then.... BLAMMO... the control toolkit works as expected. 

Post info

Tags:
Categories: Silverlight

Comments

Mark Heath
Mark Heath United Kingdom on 11/14/2008 10:51 AM Ahhh the AG_E_PARSER_BAD_TYPE error. I saw that an awful lot while learning Silverlight. It is monumentally unhelpful. I think MS need to invest a lot in getting Visual Studio smart enough to spot common XAML errors. Even if it can't 100% know what is wrong, some hints would go a long way to improving the experience for novice users.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading