locked
SemanticZoom app crash while pinch-zooming and calling ToggleActiveView

    Question

  • I have an application with a semantic zoom and a custom 'zoom out button.' By default, the semantic zoom's 'zoom out button' is only visible when using the mouse, however in our application the button is visible whenever the 'zoomed in view' is active so the user can tap the button to zoom out. 

    The application crashes when the user presses the button to toggle the SZ's active view, SemanticZoom.ToggleActiveView() but only if the user has two fingers on the scrollviewer like a 'pinch gesture'. 

    To recreate this bug, set two fingers on the zoomed in item (blue rectangle) as if they were going to zoom in or out, but without actually zooming, and begin tapping the zoom out button. It's possible for this to happen on the first try, but to get repeatable results, tap repeatedly and try restarting the pinch gesture as well. Once this is triggered, the semantic zoom will enter a state and appear to be locked up. The elements will not be visible and the UI is unrecoverable. There is no exception thrown. This may be an edge case, but in this business application the user could have unsaved data and an app crash is a serious problem. 

    I've narrowed it down to one line of code, which is in the listview for the zoomed in view.

    ScrollViewer.ZoomMode="Enabled"

    Here is the sample project I created which can reproduce this behavior.

    MainPage.xaml

    <Page
        x:Class="SemanticZoomCrash.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:SemanticZoomCrash"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
        <Page.Resources>
            <local:BooleanToVisibilityConverter x:Key="BooleanVisibilityConverter" />
        </Page.Resources>
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <SemanticZoom x:Name="ThisSemanticZoom"
                          IsZoomOutButtonEnabled="False"
                          HorizontalAlignment="Stretch"
                          ScrollViewer.HorizontalScrollMode="Disabled"
                          VerticalAlignment="Stretch">
                <SemanticZoom.ZoomedOutView>
                    <GridView Padding="100,33,40,0"
                              IsZoomedInView="False"
                              SelectionMode="None"
                              ShowsScrollingPlaceholders="False"
                              IsSwipeEnabled="False"
                              ScrollViewer.VerticalScrollMode="Enabled"
                              ScrollViewer.VerticalScrollBarVisibility="Hidden"
                              ScrollViewer.HorizontalScrollMode="Disabled"
                              ScrollViewer.IsVerticalRailEnabled="True"
                              ScrollViewer.ZoomMode="Disabled"
                              ScrollViewer.IsHorizontalRailEnabled="True">
                        <GridView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <ItemsWrapGrid Orientation="Horizontal"></ItemsWrapGrid>
                            </ItemsPanelTemplate>
                        </GridView.ItemsPanel>
                        <GridViewItem>
                            <Rectangle Margin="20,20,20,10"
                                       Fill="Red"
                                       Height="240"
                                       Width="185"></Rectangle>
                        </GridViewItem>
                    </GridView>
                </SemanticZoom.ZoomedOutView>
                <SemanticZoom.ZoomedInView>
                    <ListView IsDoubleTapEnabled="True"
                              IsZoomedInView="True"
                              ScrollViewer.IsDeferredScrollingEnabled="True"
                              ShowsScrollingPlaceholders="False"
                              ScrollViewer.ZoomMode="Enabled"
                              Padding="107,105"
                              SelectionMode="None"
                              IsSwipeEnabled="False">
                        <GridViewItem>
                            <Rectangle Fill="Blue"
                                       Width="600"
                                       Margin="25"
                                       Height="400"></Rectangle>
                        </GridViewItem>
                    </ListView>
                </SemanticZoom.ZoomedInView>
            </SemanticZoom>
            <!--Thumbnail View Button-->
            <Grid HorizontalAlignment="Right"
                  VerticalAlignment="Bottom"
                  Margin="32,2"
                  Visibility="{Binding ElementName=ThisSemanticZoom, Path=IsZoomedInViewActive, Converter={StaticResource BooleanVisibilityConverter}}">
                <AppBarButton Click="ButtonBase_OnClick"
                              Icon="ViewAll"></AppBarButton>
            </Grid>
        </Grid>
    </Page>

    MainPage.xaml.cs

    using System;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Data;

    namespace SemanticZoomCrash
    {
        /// <summary>
        /// An empty page that can be used on its own or navigated to within a Frame.
        /// </summary>
        public sealed partial class MainPage : Page
        {
            public MainPage()
            {
                this.InitializeComponent();
            }
            private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
            {
                ThisSemanticZoom.ToggleActiveView();
            }

        }

        public class BooleanToVisibilityConverter : IValueConverter
        {
            /// <summary>
            /// Converts from a system boolean to a visibility
            /// </summary>
            public object Convert(object value, Type targetType, object parameter, string language)
            {
                if (value == null) return null;
                Boolean result;
                bool succeeded = Boolean.TryParse(value.ToString(), out result);
                if (!succeeded)
                {
                    throw new ArgumentException("Object type value can not convert to Boolean");
                }
                if (result)
                {
                    return Visibility.Visible;
                }
                return Visibility.Collapsed;
            }
            /// <summary>
            /// Not Used. Required to implement IValueConverter
            /// </summary>
            public object ConvertBack(object value, Type targetType, object parameter, string language)
            {
                throw new NotImplementedException();
            }
        }
    }


    • Edited by Bryan Stump Monday, August 18, 2014 4:31 PM
    Monday, August 18, 2014 4:30 PM

All replies

  • Hi Bryan,

    >>To recreate this bug, set two fingers on the zoomed in item (blue rectangle) as if they were going to zoom in or out, but without actually zooming, and begin tapping the zoom out button. It's possible for this to happen on the first try, but to get repeatable results, tap repeatedly and try restarting the pinch gesture as well.

    Sorry, I test the app with simulator but I cannot reproduce the issue you are facing. Everything works fine.

    For this reason I would like to know more detail things, for instance you mentioned set two fingers on the blue rectangle and tapping the zoom out button, you mean use the third finger tap the button?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, August 19, 2014 7:57 AM
    Moderator
  • James,

    Yes the third finger is used to tap the button. I believe this crash would require a tablet, and some dexterity :)

    Tuesday, August 19, 2014 5:48 PM
  • Hi Bryan,

    Yes I believe we need a tablet to reproduce the issue.

    Then the question is could you tell me a scenario why do you think your app user will use third finger to touch something while he is doing a 'pinch gesture'?

    And I would like to know what is your expected result? If the button has been clicked, the SemanticZoom control switch to another view, how you want work with your current 'pinch gesture' action?

    Anyway thank you for submitting the issue to us, and I will consult senior engineer if the SemanticZoom control will get hung while pinch gesture on it.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, August 25, 2014 7:21 AM
    Moderator
  • Hi Bryan,

    I got a Tablet today and did some test, I do not see any crash when I use third finger click the button.

    I could share my project but actually it is created base on the code you wrote in the question: http://1drv.ms/1qI6BcB.

    Or you could also share your producible demo with us. Let's see if this is a device issue.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.



    Tuesday, August 26, 2014 1:48 AM
    Moderator
  • I work in enterprise software, and the issue has been tested on at least 3 surface 1 tablets. I could produce a video on how to recreate the bug.
    • Edited by Bryan Stump Friday, August 29, 2014 5:46 PM
    Friday, August 29, 2014 5:46 PM
  • If there is a video that could be even better.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, September 2, 2014 9:57 AM
    Moderator