The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
Windows store app - How to avoid App Hang when app is doing a Server communication process for long time? RRS feed

  • Question

  • Hi,

    I am having a widows store app running in Windows 8.1. In that, I am doing some server communication. the process step is as below

       

    1. Before starting server communication, i show a loading screen by showing a UI with Progress ring in a popup.
    2. Disable the Corewindow's input as below to avoid any interaction in UI.

    Window.Current.CoreWindow.IsInputEnabled = false;

     3. Start the function which talks to server. [Which takes maximum  15 seconds to 25 seconds]

    4. Once get the  response from server, i close the popup
    5. I enable the Corewindow's input as below for enabling app's interaction

    await Task.Delay(TimeSpan.FromSeconds(0.1));
    Window.Current.CoreWindow.IsInputEnabled = true;
    await Task.Delay(TimeSpan.FromSeconds(0.1));

    When the app showing, i am just touching the loading screen continuously. now app crashes and eventlog says that it is as App Hang.

    How to solve this?

    anyone please give me solution..

    Thanks.

    Saturday, November 16, 2019 1:21 PM

All replies

  • Hi, 

    I could not reproduce the issue base on your code,  I think the error log comes from the server communication. And please avoid set IsInputEnabled as false In general, we use Loading control to disable input during the service connection. 

    <controls:Loading
        x:Name="LoadingControl"
        HorizontalContentAlignment="Center"
        VerticalContentAlignment="Center"
        IsLoading="True"
        >
        <controls:Loading.Background>
            <SolidColorBrush Opacity="0.7" Color="Black" />
        </controls:Loading.Background>
        <StackPanel Padding="12" Orientation="Horizontal">
            <Grid Margin="0,0,8,0">
                <Image Height="50" Source="Assets/StoreLogo.png" />
                <ProgressRing Foreground="Blue" IsActive="True" />
            </Grid>
            <TextBlock
                VerticalAlignment="Center"
                Foreground="Black"
                Text="It's ok, we are working on it :)"
                />
        </StackPanel>
    </controls:Loading>
    


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 18, 2019 6:21 AM
  • Hi NicoZhu,

    Thank you for your suggestion.

    The crash happens only when i touch over the app screen. If do not touch the app screen's app works without any exception. So how can i avoid these happening?

    Monday, November 18, 2019 6:43 AM
  • could you debug the code when you touch the screen, I could not get exception in my side. And you could also make mini demo share with us.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 18, 2019 9:13 AM
  • Hi NicoZhu,

    The piece of code which communicate to the server is in a class library (dll). I added some logs in the process in the dll. the app crashes in the dll function. But it s happening only in the client's PC alone. Not in my development PC.

    My big doubt is, when I touch the UI in the windows store app, why it should crashes in the dll function :( i am almost spent 2 days in this :(

    NOTE: The windows store app is developed in Windows 8.1

    Monday, November 18, 2019 1:28 PM
  • The app build in Windows 8.1,  maybe the dll has some methods are not compatible for your client PC, it's hard to detect. You could try to re-write the app with Windows 10 mainstream version.

    By the way, We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, November 19, 2019 6:46 AM