Improper UI layout cause windows store app busy hang in Windows 8.1


Windows 8 store applications only need to maintain three application views: Full screen mode, snapped mode and filled mode. So the developers generally prepare three sets of UI layout. But in Windows 8.1, you can change the application width freely only if it’s large than the minimum width which is generally 500. It may bring some layout issue which makes Windows store application busy. Here is an example:

To reproduce this problem, you can create a new project, for example based on Hub template in Windows 8.1. Then add following Xaml code in ItemPage:

<Grid Grid.Row="1" x:Name="contentRegion">


     <ColumnDefinition x:Name="firstColumn" Width="600"/>

     <ColumnDefinition x:Name="secondColumn" Width="*"/>


     <ScrollViewer Grid.Column="1" >

          <TextBlock Margin="40" Text="{Binding Content}" Style="{StaticResource BaseTextBlockStyle}" />



When you click the item in HubPage to navigate to the ItemPage, the text would be shown in the ItemPage. It works fine in full screen mode. But if you resize the application width to a very small value e.g. less than 600, the UI will lose response. In some extreme scenarios, the application may crash.

Actually this issue is caused by the incorrect setting of the width of the second column. In this page, you define the width of the first column to 600 which is large than the application width. And the Textblock lays in the next column (secondColumn) has following properties settings:

            <Setter Property="TextTrimming" Value="CharacterEllipsis "/>

            <Setter Property="TextWrapping" Value="Wrap"/>

            <Setter Property="Typography.DiscretionaryLigatures" Value="True"/>

Such kind of settings are included in BaseTextBlockStyle which is the base TextBlock style in our system resource. So if you apply any system Textbook style, these settings are automatically applied to the TextBlock.  The runtime tries to parse the text in the TextBlock per theses settings. But since the width left for the TextBlock is limited, it will cause a lot of time to finish the parsing for all the text. If you use windbg to break it and check the call stack. You can find following it’s busy in RichTextServices component:

ChildEBP RetAddr 

049bcfbc 0f812084 Windows_UI_Xaml!Ptls6::LsCreateLineCore+0x363

049bcfec 0f811f3f Windows_UI_Xaml!Ptls6::LsCreateLine+0x28

049bd0bc 0f811e0e Windows_UI_Xaml!RichTextServices::Internal::LsTextLine::FormatCollapsed+0x102

049bd0e8 0f9cd747 Windows_UI_Xaml!RichTextServices::Internal::LsTextLine::Collapse+0xd1

049bd11c 0f8d8dc7 Windows_UI_Xaml!ParagraphNode::TrimLineIfNecessary+0x8e

049bd150 0f8a15e0 Windows_UI_Xaml!ParagraphNode::FormatLineAtIndex+0x78

049bd1c4 0f8a1355 Windows_UI_Xaml!ParagraphNode::ArrangeCore+0x114

049bd1e0 0f8a122e Windows_UI_Xaml!BlockNode::Arrange+0x73

049bd218 0f8a1438 Windows_UI_Xaml!ContainerNode::ArrangeCore+0x81

049bf5b8 0f880bc5 Windows_UI_Xaml!CUIElement::Arrange+0x7e1

049bf5f0 0f86218f Windows_UI_Xaml!CLayoutManager::UpdateLayout+0x136

049bf690 0f861de4 Windows_UI_Xaml!CCoreServices::NWDrawTree+0x371

049bf6d4 0f861675 Windows_UI_Xaml!CCoreServices::NWDrawMainTree+0x205

049bf6f8 0f861549 Windows_UI_Xaml!CWindowRenderTarget::Draw+0x4e

049bf730 0f861b85 Windows_UI_Xaml!CXcpBrowserHost::OnTick+0xd9

(Inline) -------- Windows_UI_Xaml!CXcpDispatcher::Tick+0x46

049bf750 0f8600b4 Windows_UI_Xaml!CXcpDispatcher::OnReentrancyProtectedWindowMessage+0x8b

 (Inline) -------- Windows_UI_Xaml!DirectUI::DXamlCore::RunMessageLoop+0x52

049bf9f4 5539f45e Windows_UI_Xaml!DirectUI::FrameworkView::Run+0x5e

049bfa00 5539f322 twinapi_appcore!Windows::ApplicationModel::Core::CoreApplicationView::Run+0x27

049bfa20 69cc008a twinapi_appcore!<lambda_f0454c86bc54370cf843d844d6c13e00>::operator()+0xb2

049bfaa4 7540495d shcore!_WrapperThreadProc+0xe2

049bfab0 774998ee KERNEL32!BaseThreadInitThunk+0xe

049bfaf4 774998c4 ntdll!__RtlUserThreadStart+0x20

049bfb04 00000000 ntdll!_RtlUserThreadStart+0x1b


To solve the problem, I suggest you adjusting the width of the first column so that you have enough width for the Textblock.



Comments (0)

Skip to main content