The World’s Leading Microsoft .NET Magazine
   
 
timstall

Donate Today!

Search Box

 

Calendar

««May 2008»»
SMTWTFS
     123
45678910
11
12
13
14
15
1617
18192021222324
25262728293031

My Top Tags

                                       

Mailing List

My RSS Feeds








Silverlight Xaml error: "Length cannot be less than zero. Parameter name: length"

posted Thursday, 10 April 2008

I was getting a strange Silverlight compile error in my Page.xaml the other day (while migrating stuff from 1.1 Alpha to 2.0 Beta):

Length cannot be less than zero.
Parameter name: length

At first it sounds like I was setting a wrong value - like trying to reference the "-1" position on a string. But, it actually was a constraint in what namespaces Xaml allows.

 

In 1.1 Alpha, this would be ok:

xmlns:Tank.Core="clr-namespace:Tank.Core;assembly=Tank.Core"

Which you could then reference like so:

<Tank.Core:Dashboard x:Name="MyDashboard" />

However, that line kept throwing the error when I tried to compile.

 

It seems like if I remove the period ".", then it works again, like so:

xmlns:Tank1="clr-namespace:Tank.Core;assembly=Tank.Core"

<Tank1:Dashboard x:Name="MyDashboard" />

Strange. I'm not fully sure why, maybe some parsing thing with periods "." in beta, but it was good to have a work-around.

tags:  

links: digg this    technorati