I was merrily chugging along developing my app with RIA Services, and I started getting AG_E_PARSER_BAD_PROPERTY_VALUE errors. The error seemed like a XAML error and stated Bad Property Error and the line and column where it occurred. But it was the line where the DomainContext was specified, like so:

<riaControls:DomainDataSource.DomainContext>
    <App:fooDomainContext/>
</riaControls:DomainDataSource.DomainContext>

The error was being raised when the Domain Data Source was initializing, but it was cryptic and just had the line and column number.
To get better error details, move the Declarative XAML (above) to the code-behind, so it is like:

fooDomainContext dc = new fooDomainContext();
this.dds.DomainContext = dc;

Now, if there was a problem with Domain Context, you will get a more meaningful error message.

Another tip: If you get an error because an unknown method was being called on the Domain Context, remember the proxy code is auto-generated and the name of the query methods are created by convention, and so a method in your web service Domain Context getFoo() will be named getFooQuery() in the client code. 
If you cannot figure out what the name is, go to the Silverlight client project and click on “Show all Files” This will show hidden auto-generated files and the Domain Context proxy would be under the hidden folder “Generated Code” – foo.Web.g.cs, where foo.Web is your Web Service project. Open the hidden file, located the Domain Context class and see what methods it provides. Hopefully, you can locate the query method name.

Hope that helps…

Advertisements