views:

189

answers:

2

Right, so on my desktop the following very very simple code hangs / freezes when compiled and run on the framework 3.5

<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<ResourceDictionary>
    <Style x:Key="s1" TargetType="{x:Type TextBlock}">
        <Setter Property="FontSize" Value="10"></Setter>
    </Style> 
</ResourceDictionary> 
</Window.Resources>
<Grid>
    <TextBlock Text="adfasdf" Style="{StaticResource s1}"></TextBlock>
</Grid>
</Window>

The issue here, as far as I am aware is the FontSize in the style that is applied to the control. When I remove it, it's fine.

If I compile it in framework 4.0 on the same machine, it works.

It works on my laptop and probably everyone else's machine, just not on my desktop.

Any help appreciated

A: 

The first impression is Huh?! Interesting. If you launch another instance of VS, attach to hung process, and click Debug -> Break All, what do you see?

Anvaka
The call stack showsPresentationCore.dll!MS.Internal.FontCache.HashTable.Lookup(MS.Internal.FontCache.IFontCacheElement e, bool add) + 0x8d bytes
Jonathan
Depending when I stop, sometimes it's a bit further as shown belowPresentationCore.dll!MS.Internal.FontCache.ElementCacher.Mapping.get() + 0x33 bytes
Jonathan
Seems like there is an endless loop
Jonathan
Hmm.. Maybe it has something to do with presentation font cache service? What happens if you disable it?
Anvaka
Thanks Anvaka, you really put me on the right track, much appreciated!!!
Jonathan
:) Glad I could help, Jonathan
Anvaka
+2  A: 

Hey everyone, I found a solution to this problem. I had to stop the FontCache service for framework 3.0 and delete the font cache.dat file that I assume was corrupt. See link below

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7cc032c1-5f4d-4518-adc6-f53afd051e6b

Jonathan