Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here
Silverlight XAML Developer Experience Issues?

Got a comment from Thomas Claudius Huber the other day in the middle of my post about “MsBuild pipeline for WPF & Silverlight”:

Hi Rob,
what about the Markup-Parsers? There are some differences between Silverlight and WPF XAML, e.g. <Button>Hello</Button> works in WPF, in Silverlight it doesn't. Would you upgrade those things too?

I answered:

Thomas-
Yes, we know we need to improve things about the Silverligh parser.  We want to make them have identical behavior!  We're working on that.
I'd love to hear what improvements in the Silverlight XAML parser are most critical to the Silverlight community.
Thanks, Rob

Thoughts?  What are your top 10 pain points for the Silverlight XAML development experience?  Feel free to give me a list via a comment…include design time, compile time and runtime issues.

[Update 2010-03-16] - See an update about the Silverlight 4 XAML Parser overhaul: http://blogs.windowsclient.net/rob_relyea/archive/2010/03/15/david-poll-silverlight-4-xaml-parser-overhaul.aspx

Published Tuesday, September 08, 2009 9:15 AM by Rob_Relyea

Comments

# re: Silverlight XAML Developer Experience Issues?@ Wednesday, September 09, 2009 2:58 AM

Well, I'm mainly focused on WPF. Switching from WPF to Silverlight is realy hard.

#1 lack of content parsing

WPF:

<Button>Content</Button>

Silverlight:

<Button Content="Content"></Button>

#2 Control namespaces are different than in WPF. Maybe a namespace mapping mechanism would help.

Benny

# re: Silverlight XAML Developer Experience Issues?@ Wednesday, September 09, 2009 6:59 AM

Rob,

there's so many issues that I forget.  

I think generally the worst problem is the error reporting, which is just so much worse than WPF.  Quite often a parsing error will come up that you have no idea of the context or which part of the page is reporting the problem on any waste a lot of time removing code in order to figure out what's going wrong, particularly if the code works perfectly fine with WPF.

One of the problems that I have reported as a bug is the fact you can't set values of properties on a converter as described here:

connect.microsoft.com/.../ViewFeedback.aspx.

x:Static support would certainly make my life easier.

If, as you discussed elsewhere, the parsers were the same between WPF & Silverlight it would certainly make sharing code between them much simpler.

More as I remember...

...Stefan

# Dew Drop &#8211; September 9, 2009 | Alvin Ashcraft&#039;s Morning Dew@ Wednesday, September 09, 2009 8:30 AM

Pingback from  Dew Drop &#8211; September 9, 2009 | Alvin Ashcraft&#039;s Morning Dew

# re: Silverlight XAML Developer Experience Issues?@ Wednesday, September 09, 2009 10:25 AM

Here are the first few that come to mind, in alphabetical order:

- Custom markup extensions

- DynamicResource

- MultiBinding

- No more E_USELESS_FAILURE_MESSAGES

- Recognize XmlnsDefinitionAttribute

- x:Static

- x:Type

- x:TypeArguments/generics

(It seems like there were some issues with Binding as well, but it may just be SL2 that I'm thinking of.)

In general, _every_ difference between WPF and Silverlight causes us pain, so any step towards making things consistent will have a BIG impact. Thank you!

# re: Silverlight XAML Developer Experience Issues?@ Wednesday, September 09, 2009 3:19 PM

Thanks...keep it coming.

Remember to focus on all aspects here, design time, compile time, and runtime improvements.

I'd prefer prioritized lists over alphabetical along with details about the pain they cause.

# re: Silverlight XAML Developer Experience Issues?@ Thursday, September 10, 2009 12:20 AM

Rob,

here's an example of the problems in trying to debug Silverlight xaml.  

Firstly, I had a problem with a parser error because I was trying to add an ItemPanelTemplate into an ItemControl. Of course it didn't give me the line number of the error, so I had to figure that out because the problem was in generic.xaml.

Secondly having removed that I found that I couldn't create an ItemPanelTemplate in C# code (who knows why - WPF can...) so I tried a few other things in generic.xaml and now I have this error:

Error HRESULT E_FAIL has been returned from a call to a COM component.

There is no inner exception, and I have no way of knowing what the problem is I've gone back to my original version of the file, that did work and I've got the same problem still.

Fundamentally the problem is about a complete lack of information.  It may well be that I've done something wrong, but I have no idea what. I can spend hours trying to debug the simplest things, because often you don't even know where the problem is occurring because the line number and file reporting is so poor.

Which brings me on to your question regarding compile time, I think that compile time could be substantially improved by reporting these errors before we actually get to runtime.

...Stefan

# re: Silverlight XAML Developer Experience Issues?@ Thursday, September 10, 2009 4:52 AM

Triggers, pleeeeease!

The VSM is the worst thing ever. Please don't bring it to WPF, instead bring Triggers to SL.

by Flo

# re: Silverlight XAML Developer Experience Issues?@ Thursday, September 10, 2009 7:14 AM

Flo-

I'll pass that feedback on...

Realize though, we're talking (mostly) about how the markupcompiler & parser works, not what types exist in Silverlight.

Don't take this post as a question for what features you'd like to see in Silverlight...but more like what XAML features are most critical for you in Silverlight.

Thanks, Rob

# re: Silverlight XAML Developer Experience Issues?@ Thursday, September 10, 2009 6:26 PM

Rob,

Here is a practical example of a problem that I have had today.  I copied some code from a user control into a custom control using generic.xaml and when I run it I get the error message:

AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 8 Position: 217].

I have absolutely no idea where the line number comes from - it relates to nothing as far as I can tell, but the worst part of the problem is I have no clue which property it is.  As it turns out the problem is that I hadn't removed some event handlers e.g:

<Button Click="OnButtonClicked">

if I recall correctly, WPF handles this at the compiler level so you don't end up with a runtime problem.

The problem with the error message is I have no idea what it relates to - it doesn't tell me which property, which file, which line.

...Stefan

# re: Silverlight XAML Developer Experience Issues?@ Monday, September 14, 2009 9:02 AM

Hi Rob,

thanks for picking up my comment. I've just made a small post about the things I'm missing most in Silverlight's XAML-Parser. As I'm coming from WPF, these are all things that exist in the XAML-Parser WPF is using. Find the post here:

www.thomasclaudiushuber.com/.../thoughts-of-improvements-to-silverlights-xaml-parser

# re: Silverlight XAML Developer Experience Issues?@ Tuesday, September 15, 2009 9:40 PM

Rob,

Today I've been working through updating my the Silverlight version of my virtual tour software.  It reminds me of one of my pet hates about Silverlight/WPF xaml compiler, and that is the way it deals with linked files.

If I add a xaml file or any other type of resource file as a linked file into a folder (ie not at root) from the existing item dialog, when we build the resulting project, the file appears in the resources at the root level and at not at the subfolder level.  

This makes it between somewhat difficult and impossible to single source xaml files between Silverlight and WPF.

Will there be a solution for this in future versions of these compilers?

...Stefan

# re: Silverlight XAML Developer Experience Issues?@ Tuesday, October 27, 2009 9:55 PM

XAML visual inheritance.

Although this is not supported in WPF either, it needs to be supported in both. I just can't believe that it would be all too difficult to come up with a solution for that.

Suppose you have a core product. Every client wants this customized. I don't want to have to duplicate the entire layout of something. I realize that templates can solve a lot of issues, but you just can't achieve the same simplicity of visual inheritance as in something like WinForms or Delphi.

We really need this.

by JeffG

# re: Silverlight XAML Developer Experience Issues?@ Thursday, October 29, 2009 12:22 AM

Rob,

I noticed another difference between the xaml parsers and WPF and Silverlight.  If I want to parse a string into xaml, I have to do it like this:

ActiveFormXaml =

#if !SILVERLIGHT

                       XamlReader.Parse(_activeForm.Xaml)

#else

                       XamlReader.Load(_activeForm.Xaml)

#endif

                       as FrameworkElement;

Why are there two different functions in WPF and Silverlight for the same task?

What's worse, when I tried to test this in Visual Studio 2010. I discovered that XamlReader doesn't have a load or a parse function - so I'm not sure how was supposed to write code that works across both platforms without all these horrible #ifdefs.  Hopefully your talk at PDC will be able to explain that the Silverlight and WPF APIs are being made more consistent! :-)

Looking forward to watching it!

...Stefan

# re: Silverlight XAML Developer Experience Issues?@ Wednesday, January 20, 2010 9:06 AM

You are so right about these issues.  XAML debugging is afr too hard.  Easing this is more importamt than any other Silverlight development.

by PBL

# re: Silverlight XAML Developer Experience Issues?@ Tuesday, March 16, 2010 7:27 PM

See the update in the blog post above about the new Silverlight 4 XAML Parser overhaul.

While it doesn't address all your issues listed, I hope you'll agree it is a great start.

Thanks, Rob

# @mstrobel: System.Xaml.dll available on Mono? More XAML support on Silverlight?@ Wednesday, April 07, 2010 11:21 PM

This twitter conversation happened the other day between mstrobel and myself: (read top to bottom). &#160;

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Page view counter