Page view counter

Silverlight Tips of the Day - Blog by Mike Snow

Game Programming with Silverlight

Silverlight Tip of the Day #96 – The meaning of AG_E_PARSER_BAD_PROPERTY_VALUE

If you ever run into this error when running your application you might be a bit perplexed by its encrypted meaning.

Looking at the exceptions details you will see something like which really doesn’t help you very much:

System.Windows.Markup.XamlParseException occurred
  Message="AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 4 Position: 53]"
  LineNumber=4
  LinePosition=53
  StackTrace:
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at MapEditor.TerrainTile.InitializeComponent()
       at MapEditor.TerrainTile..ctor(Double xLoc, Double yLoc, Double tileRadius)
  InnerException:

The Silverlight Team is working to make improvements in error reporting. For now, to better understand what is causing these errors you should take a careful look at your XAML to see if something declared is missing or wrong. For example, say you have an event handler in your XAML that is not anywhere to be found in your code behind. Often I find myself removing an event handler I no longer want in my code behind but forgetting to remove it in my XAML as well.

Now you know (if you didn’t already).

--Mike

Comments

Microsoft Weblogs said:

If you ever run into this error when running your application you might be a bit perplexed by its encrypted

# February 20, 2009 10:15 PM

obsid said:

Dont think for a second this is the only place that error occurs.  I have had this error hundreds if not thousands of times, for a variety of reasons.  Your lucky that you got a stack trace at all.  Alot of the time it just comes back that a call to XcpImports failed with an error code of 0x00000 or something similar.  I see alot of problems with attached depeancy properties if everything isnt exactly right.  There are tons of places that cause this error, and it isnt clear at ALL which one of the dozen possible causes is the reason.  All the error messages that start with AG_E_... are really crappy in telling you how or why something failed.

# February 20, 2009 11:31 PM

wireplay said:

Can we just say, politely, that error reporting in Silverlight is lacking? Silverlight team should put a LOT of effort into this area because it is really bad right now. I don't understand the complexities, I am sure, but it is a place to make some improvements, IMO.

# February 20, 2009 11:40 PM

Community Blogs said:

In this issue: ScrumWall, Mike Snow, Joel Neubeck, WorkSight Blog, Robby Ingebretsen, and Bill Reiss

# February 21, 2009 8:46 PM

The meaning of AG_E_PARSER_BAD_PROPERTY_VALUE said:

Pingback from  The meaning of AG_E_PARSER_BAD_PROPERTY_VALUE

# February 23, 2009 9:14 AM

tgrand said:

Agree with the previous posters.  These errors often shed little or no light on the problem.  Not much fun to debug, especially in those nasty cases when the problem only happens on 2 machines out of 10.

Better error reporting would be a huge improvement to Silverlight.

# February 23, 2009 10:27 AM

mike.snow said:

Thanks for your feedback. I have talked with people on the Silverlight team and they are working to make great improvements in this area.

# February 23, 2009 11:45 AM

tgrand said:

Thanks Mike, that's great news!

# February 25, 2009 11:30 AM

Programming with Silverlight, WPF & .NET » AG_E_PARSER_BAD_PROPERTY_VALUE said:

Pingback from  Programming with Silverlight, WPF & .NET » AG_E_PARSER_BAD_PROPERTY_VALUE

# February 28, 2009 5:48 AM

sandeepsaxena said:

How should I fix this in my xaml.vb file ?

# March 12, 2009 3:46 AM

Visual Web Developer Team Blog said:

Most Recent Posts: Silverlight Tip of the Day #106 - Setting Default Browser from within VS Silverlight

# April 6, 2009 6:13 PM

Silverlight Tips of the Day - Blog by Mike Snow said:

The purpose of this post is to create an outline summary all the blogs from my Silverlight Tips of the

# April 6, 2009 6:20 PM

NewsPeeps said:

Thank you for submitting this cool story - Trackback from NewsPeeps

# August 8, 2009 6:36 PM

Dark Jester said:

Ran into this today. One thing of note is that when I opened the .Xaml page in Expression Blend, it gave me the exact location of the error. Better debug features in Blend than in SL itself? :)

# October 7, 2009 5:11 PM

Harlequin said:

Sometimes you get this error in Blend itself, and I've had cases where Blend is running functions(like recalculating Canvas sizes) that it dies on. Adding this to some functions(code snippet below) can remove this error in Blend 3. I used this, as an example, in a function of a sliders value changed, where the slider was changing the size of something on the page. Blend didn't like this stuff, so adding the following at the top of the function made my control show up again in Blend.

if (DesignerProperties.GetIsInDesignMode(this))

  return;

# February 5, 2010 2:24 PM

ckelley said:

I got it after I subclassed the DatePicker and tried to Bind to one of the new properties.  Beats me why it didn't like my binding instruction.

# February 27, 2010 8:31 AM

duncan bayne said:

It's April 2010, I'm using SL4, and I'm still getting AG_E_PARSER_BAD_PROPERTY_VALUE errors.  Silverlight is still a country mile behind RoR in terms of helpful error reporting :-(

# April 28, 2010 1:03 AM

drotondo said:

Thank you for posting this.  First Google result and it quickly helped me know what/where to look for my issue.  I had two methods (one inserted by Visual Studio and the other by Blend) with the same name.

Removed one and this error went away.  It's funny that neither the Visual Studio or Blend IDE recognized there was an error during build.  Just threw an error in my development environment when the browser tried to load the application.

# January 23, 2011 4:32 PM

AG_E_PARSER_BAD_PROPERTY_VALUE | Dan Clarke said:

Pingback from  AG_E_PARSER_BAD_PROPERTY_VALUE | Dan Clarke

# May 30, 2011 9:01 AM

paul hoenecke said:

I was getting this error in Blend 4 designer. Tried many things to find the source of the problem... In the end, RESTARTING BLEND fixed it...

# September 25, 2011 7:07 PM