locked
App crash when using specific combination of NavigationCacheMode="Enabled" + AppBarButton + Style with Icon RRS feed

  • Question

  • Hi,

    I've just discovered completely valid scenario, where Windows 8.1 C#/XAML app crashes without any meaningful Exception using just this configuration:

    Blank Windows 8.1 app, in App.xaml

    <Application.Resources>
     <Style x:Key="MyAppBarButtonStyle" TargetType="AppBarButton">
      <Setter Property="Icon" Value="Previous"/>
     </Style>
    </Application.Resources>

    In Page1 and Page2 XAML contains just this:

    <Page x:Class="Sample.Page1/2"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        NavigationCacheMode="Enabled">
        <AppBarButton Style="{StaticResource MyAppBarButtonStyle}" Click="ButtonBase_OnClick"/>
    </Page>

    Page1 button handler navigates to Page2, Page2 button handlers calls frame.GoBack();

    When I start the app and click the button, I go to Page2, if click the button here, I go back to Page1 and the app crashes.

    As far as I know, the app just crashes for no reason when using wrong combination of NavigationCacheMode="Enabled" + AppBarButton with Icon set via Style, used on both pages.

    Note I can use some workarounds for fixing this on my side, like using different styles for buttons, not using NavigationCacheMode=Enabled. etc. but it should be fixed anyway - I've spent about one day trying to narrow down the simplest scenario that crashes my app and found out, it's not my bug but error in the framework.

    Here's a sample for reproducing this bug: http://sdrv.ms/LSAlXg

    Thursday, February 6, 2014 9:30 AM

All replies

  • Can you please provide a repro sample in a zip file? Windows cannot open 7z files without additional software.

    Can you elaborate on "without any meaningful Exception"? Do you have the debugger set to just your code or to managed exceptions only? The Windows Runtime classes are in native code and so raise native exceptions.

    --Rob

    Thursday, February 6, 2014 10:14 PM
    Moderator
  • Here's the sample in zip format: http://sdrv.ms/1fT1cv7

    And here's another sample, that is crashing in Windows 8.1: https://gist.github.com/martinsuchan/8847868

    Apparently the AppbarButton.Icon property is not implemented properly and cannot be set in Styles as other Controls.

    Monday, February 10, 2014 1:35 PM