Page view counter
Silverlight hangs on Content="{TemplateBinding Content}
Last post 04-03-2008 6:57 AM by oohogwash. 13 replies.
Sort Posts:
03-07-2008 4:30 PM
Silverlight hangs on Content="{TemplateBinding Content}
Hello, I'm just evaluating the current SL 2.0 beta build. When trying the "Changing the Appearance of an Existing Control" Quickstart (http://silverlight.net/Quickstarts/BuildUi/47391440-987f-43d8-a4e4-b04a8133a5cc.aspx I've run into problem, that causes Silverlight to hang. The minimal repro case is this: When running from Visual Studio 2008 in debug mode it causes IE to hang with Devenv.exe and IEplore.exe using 100% CPU. Running without a debugger attached causes both IE and Firefox to hang with 100% CPU. When I remove the Content="{TemplateBinding Content}" part, silverlight starts again. Is the code wrong or is this a known problem? Any help is appreciated. My Test system is running Vista x64 SP1. Enjoy your weekends! Ben
bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-07-2008 4:33 PM
Re: Silverlight hangs on Content="{TemplateBinding Content}

Ok, looks like the forum doesn't work in opera, trying to post again, hopefully retaining my formatting and tags...

I'm currently evaluating the current SL 2.0 beta build. When trying the "Changing the Appearance of an Existing Control" Quickstart  (http://silverlight.net/Quickstarts/BuildUi/47391440-987f-43d8-a4e4-b04a8133a5cc.aspx I've run into problem, that causes Silverlight to hang.

The minimal repro case is this:

<UserControl x:Class="TestApp1.Appearance"
    xmlns="http://schemas.microsoft.com/client/2007"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300">
 <StackPanel>

  <StackPanel.Resources>
   <Style TargetType="Button" x:Key="buttonStyle">
    <Setter Property="Template">
     <Setter.Value>
      <ControlTemplate>
       <Grid x:Name="ELEMENT_Root">
        <Rectangle x:Name="Base"
            RadiusY="2" RadiusX="2"
         />
        <ContentPresenter
  Content="{TemplateBinding Content}"
   />
       </Grid>
      </ControlTemplate>
     </Setter.Value>
    </Setter>
   </Style>
  </StackPanel.Resources>

  <Button Content="Button 1" Style="{StaticResource buttonStyle}"/>
 </StackPanel>
</UserControl>

When running from Visual Studio 2008 in debug mode it causes IE to hang with Devenv.exe and IEplore.exe using 100% CPU.
Running without a debugger attached causes both IE and Firefox to hang with 100% CPU.

When I remove the  Content="{TemplateBinding Content}" part, silverlight starts again.

Is the code wrong or is this a known problem? Any help is appreciated.

My Test system is running Vista x64 SP1.

Enjoy your weekends!

Ben

bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-07-2008 9:51 PM
Re: Silverlight hangs on Content="{TemplateBinding Content}

Hi Ben,

Please try and add TargetType="Button" on the ControlTemplate in the Style

 i.e

<Style TargetType="Button" x:Key="buttonStyle">
    <Setter Property="Template">
     <Setter.Value>
      <ControlTemplate TargetType="Button" >
       <Grid x:Name="ELEMENT_Root">

 

 

Keith Mahoney
Silverlight SDET
Microsoft

Keith.Mahoney

Loading...
Joined on 03-08-2008
Vancouver
Posts 103
03-08-2008 4:29 AM
Re: Silverlight hangs on Content="{TemplateBinding Content}

Hi Keith,

 I tried your suggestion, unfortunatly Silverlight still hangs, didn't seem to make any difference.

Can anyone actually reproduce the hang?

 Ben

bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-08-2008 4:54 AM
Re: Silverlight hangs on Content="{TemplateBinding Content}

I believe the hang could be caused by some interaction with my graphics card driver. I have just updated the drivers for my GeForce 8600 GTS from the latest offical release (169.25) to the latest beta (169.44). Now Silverlight still hangs with 100% CPU but in addition it now also rapidly leaks memory...

bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-08-2008 5:33 AM
Re: Silverlight hangs on Content="{TemplateBinding Content}
Well, I've reverted back to my old graphics driver and the memory leak is still there. Either I didn't notice the leak before or the beta drivers changed something that uninstalling didn't undo or the leak had nothing todo with the graphics card in the first place, dunno... Guess I'll try running Silverlight in a VPC image and hope it works better there...

 

bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-08-2008 8:24 AM
Re: Silverlight hangs on Content="{TemplateBinding Content}

Hangs in XP Sp2 x32 running in VPC as well.

I have uploaded the test here:

 http://bschwehn.de/temp/sl/test.html

 I'd appreciate any feedback if this hangs and leaks for other people too.

 Thanks

Ben

bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-08-2008 9:21 PM
Re: Silverlight hangs on Content="{TemplateBinding Content}

Hi Ben,
I am seeing the hang by navigating to your link, but I do not see it when I copy and paste your xaml into Visual Studio and build it myself. Could you please share out your Visual Studio Solution so I can take a look at it?
 

Keith Mahoney
Silverlight SDET
Microsoft

Keith.Mahoney

Loading...
Joined on 03-08-2008
Vancouver
Posts 103
03-09-2008 5:17 AM
Re: Silverlight hangs on Content="{TemplateBinding Content}

Hello Keith thanks for looking into this.

Here's the SL app with VS solution:

http://bschwehn.de/temp/sl/Silverlightttests.zip

The test link didn't run on an IIS Server, so it doesn't use the aspx/ajax page but test.html

 It's pretty much all copy'n'paste from the quick starts.

 Ben

 

 

bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-10-2008 2:08 AM
Marked as Answer
Re: Silverlight hangs on Content="{TemplateBinding Content}

Hello, actually the problem is, you're referencing to StaticResources that don't exist. As soon as you add the resources, it should be OK. One more thing, there're some problems on the quick starts. The root Grid's name should be RootElement, rather than ELEMENT_Root...

<Grid x:Name="RootElement">

<Grid.Resources>

<SolidColorBrush x:Key="ReflectionGradient" Color="Aqua"/>

<SolidColorBrush x:Key="AccentBrush" Color="Red"/>

</Grid.Resources>

 

shanaolanxing - This posting is provided "AS IS" with no warranties, and confers no rights.

Yi-Lun Luo - MSFT

Loading...
Joined on 10-29-2007
Posts 2,455
03-10-2008 6:24 AM
Re: Silverlight hangs on Content="{TemplateBinding Content}

Hello Yi-Lun Luo,

well, that was easy :)

Thanks a lot. Hope beta 2 will give an error message instead of a hang :)

 Ben

bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-10-2008 12:03 PM
Re: Silverlight hangs on Content="{TemplateBinding Content}

I had another look at this problem. Adding the resource bit fixed the problem for the code I uploaded, but I unfortunately didn't upload the minimal code example which is just: 

 

<UserControl x:Class="TestApp1.Appearance"

xmlns="http://schemas.microsoft.com/client/2007"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Width="400" Height="300">

<StackPanel>

<StackPanel.Resources>

<Style TargetType="Button" x:Key="buttonStyle">

<Setter Property="Template">

<Setter.Value>

<ControlTemplate>

<Grid x:Name="RootElement">

<Rectangle x:Name="Base"

RadiusY="2" RadiusX="2"

/>

<ContentPresenter

Content="{TemplateBinding Content}"

/>

</Grid>

</ControlTemplate>

</Setter.Value>

</Setter>

</Style>

</StackPanel.Resources>

<Button Content="Button 1" Style="{StaticResource buttonStyle}"/>

</StackPanel>

</UserControl>

http://bschwehn.de/temp/sl/Silverlighttests2.zip

 As you can see, I'm not referencing any missing resources but SL still hangs. I don't know, but I think this might be an additional issue perhaps? Anyways, your suggestion fixed the problem for the full example.

 Thanks

Ben

 

 

bschwehn

Loading...
Joined on 03-07-2008
Posts 13
03-10-2008 10:40 PM
Marked as Answer
Re: Silverlight hangs on Content="{TemplateBinding Content}

I think it is because you missed TargetType="Button" on the ControlTemplate tag. As soon as I added that property, it worked fine.

shanaolanxing - This posting is provided "AS IS" with no warranties, and confers no rights.

Yi-Lun Luo - MSFT

Loading...
Joined on 10-29-2007
Posts 2,455
04-03-2008 6:57 AM
Re: Silverlight hangs on Content="{TemplateBinding Content}

I have the same problem in a totally different project, I seem to have all of the code in place mentioned in this list so far. The work around I used was to use a different property, in my case I used Tag.

oohogwash

Loading...
Joined on 10-22-2007
Posts 20
Microsoft Communities