【问题标题】:WPF FontSize style hangs / freezes / stops respondingWPF FontSize 样式挂起/冻结/停止响应
【发布时间】:2011-01-22 16:52:32
【问题描述】:

对,所以在我的桌面上,以下非常非常简单的代码在框架 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>

据我所知,这里的问题是应用于控件的样式中的 FontSize。当我删除它时,它很好。

如果我在同一台机器上用 framework 4.0 编译它,它可以工作。

它可以在我的笔记本电脑和其他人的机器上运行,只是不能在我的台式机上运行。

任何帮助表示赞赏

【问题讨论】:

    标签: wpf visual-studio-2008 .net-3.5 themes freeze


    【解决方案1】:

    大家好,我找到了解决这个问题的方法。我不得不停止框架 3.0 的 FontCache 服务并删除我认为已损坏的字体 cache.dat 文件。见下方链接

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

    【讨论】:

      【解决方案2】:

      第一印象是嗯?!很有趣。如果您启动另一个 VS 实例,附加到挂起的进程,然后单击 Debug -&gt; Break All,您会看到什么?

      【讨论】:

      • 调用堆栈显示 PresentationCore.dll!MS.Internal.FontCache.HashTable.Lookup(MS.Internal.FontCache.IFontCacheElement e, bool add) + 0x8d bytes
      • 取决于我什么时候停止,有时它会更远,如下所示 PresentationCore.dll!MS.Internal.FontCache.ElementCacher.Mapping.get() + 0x33 bytes
      • 好像有一个死循环
      • 嗯.. 也许它与演示字体缓存服务有关?如果禁用它会发生什么?
      • :) 很高兴我能帮上忙,乔纳森
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-28
      相关资源
      最近更新 更多