none
Banner refresh eventually freezes app. RRS feed

  • Question

  • Hello,

    When ads in my app get refreshed then the CPU usage starts increasing more and more. If the CPU usage rises to about 10-15% then the app freezes. Energy usage is at that moment also very high.

    The app has the following global structure. There’s a Mainpage which is divided in three rows. On the first and third row there’s an adcontrol. On the second row there’s a frame which is used to load other pages.

    I have tried to improve performance by setting the IsAutoRefreshEnable property to true. It has the result that the problem takes longer to happen because banners are less often loaded. I  have tried to add the adcontrolls to the mainpaige in code behind in the loaded event but this also has the same result.

    I have tried to update the advertising sdk via NuGet. Partial path:

    .nuget\packages\microsoft.advertising.xaml\10.1811.22001\SDK\WindowsKits\10\ExtensionSDKs\Microsoft.Advertising.Xaml\10.0\

    I hope anybody is able to advise me to improve the situation.

    Thanks

    Tuesday, October 8, 2019 5:46 PM

All replies

  • Hi,

    What specific operations did you do in your frame? Is there also an operation like timing refresh? In addition, when I used the adControl and when it refreshed, it only increased 1 to 2MB, but it would fall again after the refresh. If you create a blank project and do nothing only add adcontrol, will the same issue occur?

    Best Regards,

    Fay


    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.


    Wednesday, October 9, 2019 6:03 AM
  • Hello Fay,

    Thanks for your reply.

    I do not believe I have operations which have a timing refresh. If the app has started and the portal page would be loaded in the frame it would only have buttons with a click event to load another page:

    private void CreateBookmarks_Click(object sender, RoutedEventArgs e) {       this.Frame.Navigate(typeof(CreateBookmarks), nullnew DrillInNavigationTransitionInfo());
    }

    I have created a new project with an adcontrol and have the same behavior as you described. If you would add 30 adcontrols to a stackpanel you would probably get the same behavior (same feel) I would get. About memory usage, if you would leave the app as it is then there is a certain amount of buildup. If you would work with the app and ads are refreshed then you would get noticeably interrupted.

    Best Regards

    Wednesday, October 9, 2019 6:50 PM
  • Hi,

    From the actual situation, do you put 30 adcontrols in your app? If yes, according to the memory is too high and affects your performance, I suggest you can put a little less. If you only put one or two and the memory is too high, then this is a problem. But I can't reprocude it, so can you please provide a simple sample for us to reproduce?

    Best Regards,

    Fay


    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.

    Thursday, October 10, 2019 9:07 AM
  • Hello,

    In the actual situation I have just two ads. When I remove the ads then the memory remains stable, it could even drop. On load it’s about 32MB after an hour it uses around 27MB. I have included some code to give an idea about code “framework” of the app. Please let me know if you need other code.

    Regards


    <!—xaml mainpage -->

    <Grid Background="{StaticResource DarkOverlayColor}">

            <Grid.RowDefinitions>

                <RowDefinition Height="60"/>

                <RowDefinition />

                <RowDefinition Height="60"/>

            </Grid.RowDefinitions>

           

            <!-- upper banner--> 

            <Grid>

                <Grid.ColumnDefinitions>

                    <ColumnDefinition Width="200"/>

                    <ColumnDefinition />

                    <ColumnDefinition Width="200"/>

                </Grid.ColumnDefinitions>

     

                <Grid Grid.Column="1" Background="{StaticResource ApplicationPageBackgroundThemeBrush}"

                      HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="grdBanner1">

                    <!--

                    ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"

                    AdUnitId="test"

                   

                    -->

                    <UI:AdControl x:Name="adcBanner1"

                        Background="{StaticResource DarkOverlayColor}"

                                  

                        ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"

                        AdUnitId="test"                   

                        Height = "50"

                        Width = "320"

                        />

                </Grid>

     

                <Grid Grid.Column="2" PointerEntered="Grid_PointerEntered"

                      Background="Transparent"

                      >

                   

                </Grid>

            </Grid>

           <Grid Grid.Row="1" Margin="1">

     

              <Frame Name="appFrame" >               

                   

               </Frame>

               <!— dialogs get expanded and collapsed by other pages loaded in the frame -->

               <Grid x:Name="grdDialogA" Visibility="Collapsed" />          

               <Grid x:Name="grdDialogB" Visibility="Collapsed" />

               <Grid x:Name="grdDialogC" Visibility="Collapsed" />

           </Grid>

            <Grid Grid.Row="2" Background="{StaticResource ApplicationPageBackgroundThemeBrush}"

                 x:Name="grdBanner2"     HorizontalAlignment="Center" VerticalAlignment="Center">

     

                <UI:AdControl x:Name="adcBanner2"

                        Background="{StaticResource DarkOverlayColor}"

                                  

                        ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"

                        AdUnitId="test"                   

     

                        Height = "50"

                        Width = "320"

                 />

            </Grid>

     

    </Grid>

    // codebehind mainpage

    private async void Page_Loading(FrameworkElement sender, object args) {          

           // load data async       

           // load portal page                

         appFrame.Navigate(typeof(Portal), nullnew DrillInNavigationTransitionInfo());

    }

     

     

    <!— xaml portal page  example -->

    <Grid>

     

            <Grid>

                <Image Grid.Column="0" x:Name="imgBackground" HorizontalAlignment="Center"                             Margin="0,15, 0, 15" VerticalAlignment="Center"  Opacity="0.20"

                   Source="/Afbeeldingen/home.PNG"/> 

            </Grid>

                   

            <Grid >

                <Grid.ColumnDefinitions>

                    <ColumnDefinition/>

                    <ColumnDefinition Width="3*"/>

                    <ColumnDefinition/>

                </Grid.ColumnDefinitions>

     

                    <Grid Grid.Column="1" >

                        <Grid.ColumnDefinitions>

                            <ColumnDefinition/>

                            <ColumnDefinition Width="7*"/>

                            <ColumnDefinition/>

                        </Grid.ColumnDefinitions>

     

                        <StackPanel  Grid.Column="1" VerticalAlignment="Center">

                        <!— {x:Bind Path=taal.BladwijzersMaken}-->

     

                            <Button Content="Create bookmarks"

                                    Click="bCreateBookmarks_Click" />

     

                            <Button Content="Archive bookmarks" Click="bArchiveBookmarks_Click"/>

     

                        <!—

                               .

                               .

                               .

                        -->

                        </StackPanel>

     

                    </Grid>

                   

     

     

            </Grid>

                  

    </Grid>

    //codebehind portal page 

    private void Page_Loading(FrameworkElement sender, object args)

    {

        // get language data (implemented with interface and databinding)            

        language = currentLanguage;

         // show / hide background image

         background.Show(imgAchtergrond, Instellingen.TgsStartschermIsOn);

    }

    // example clickevent
    private void bCreateBookmarks_Click(object sender, RoutedEventArgs e) {           

                this.Frame.Navigate(typeof(BladwijzersMaken), null,                                                     new DrillInNavigationTransitionInfo());

    }



    Thursday, October 10, 2019 4:37 PM
  • Hi,

    When the adcontrols load a long time, it's memory indeed raises but the app does not freeze. About this issue, I will ask other engineers to see it. 

    Best Regards,

    Fay


    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.

    Friday, October 11, 2019 8:57 AM