ILoggable

A place to keep my thoughts on programming

January 3, 2008 .net , ,

Copying a Silverlight User Control from one project to another

Here’s something I tracked down with no help from error messages:

When you copy a user control in Silverlight 1.1 from one project to another the Xaml that the control loads will have it’s Build Action set to SilverlightPage. When you then run your project and try to create an instance of that control you’ll get the ever so informative AG_E_INVALID_ARGUMENT. All you need to do to fix it, is set the Build Action to Embedded Resource again. Tada!

I love declarative definition of UI with behavior wired to static code. But man, at its current state, the debugging support for it just isn’t there. I mean it’s bad enough that having strings in the declarative side to link to actions that won’t be updated by normal refactoring, nor will they show up as references, but at this state Xaml brings the worst part of scripting languages to compile-time checked coding:

Vague runtime errors without a stacktrace

Bah.

Leave a comment