0

I am creating a xamarin forms application on the iOS platform currently using a PCL. In the application output, whenever I switch pages, I get this message:

Unbalanced calls to begin/end appearance transitions for <Xamarin_Forms_Platform_iOS_NavigationRenderer_ParentingViewController: 0x10526a7c0>.

After continuing to switch through pages for a few minutes, I finally get this row of messages:

2018-08-14 13:46:02.633 MC_Phone.iOS[1943:245399] Unbalanced calls to begin/end appearance transitions for <Xamarin_Forms_Platform_iOS_NavigationRenderer_ParentingViewController: 0x10526a7c0>.
2018-08-14 13:46:04.599 MC_Phone.iOS[1943:245399] critical:         Stacktrace:

2018-08-14 13:46:04.599 MC_Phone.iOS[1943:245399] critical:   at <unknown> <0xffffffff>
2018-08-14 13:46:04.599 MC_Phone.iOS[1943:245399] critical:   at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0x00007>
2018-08-14 13:46:04.602 MC_Phone.iOS[1943:245399] critical:   at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:79
2018-08-14 13:46:04.602 MC_Phone.iOS[1943:245399] critical:   at UIKit.UIApplication.Main (string[],string,string) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:63
2018-08-14 13:46:04.603 MC_Phone.iOS[1943:245399] critical:   at MC_Phone.iOS.Application.Main (string[]) [0x00007] in /Users/petercardenas/Documents/Berk/MC_Phone4_1 Updated/MC_Phone/MC_Phone.iOS/Main.cs:13
2018-08-14 13:46:04.603 MC_Phone.iOS[1943:245399] critical:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) [0x0001e] in <b238a3153e534349ad10ed0787f2157a#AFB9630D-719E-DB9C-AF13-58F1BC53B75F>:0
2018-08-14 13:46:04.604 MC_Phone.iOS[1943:245399] critical: 
Native stacktrace:

2018-08-14 13:46:04.660 MC_Phone.iOS[1943:245399] critical:     0   libmonosgen-2.0.dylib               0x0000000104ca9b24 mono_handle_native_crash + 224
2018-08-14 13:46:04.660 MC_Phone.iOS[1943:245399] critical:     1   libmonosgen-2.0.dylib               0x0000000104cb6680 mono_sigsegv_signal_handler + 316
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical:     2   libsystem_platform.dylib            0x0000000182e4cb58 _sigtramp + 52
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical:     3   UIKit                               0x000000018d183318 <redacted> + 1024
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical:     4   UIKit                               0x000000018cef2a4c <redacted> + 708
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical:     5   UIKit                               0x000000018cef26a4 <redacted> + 164
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical:     6   UIKit                               0x000000018cee63a8 <redacted> + 188
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical:     7   UIKit                               0x000000018ce3e6f4 <redacted> + 1420
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical:     8   QuartzCore                          0x00000001873b3e54 <redacted> + 184
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical:     9   QuartzCore                          0x00000001873b7fe4 <redacted> + 324
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical:     10  QuartzCore                          0x00000001873246c8 <redacted> + 320
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical:     11  QuartzCore                          0x000000018734c1b0 <redacted> + 580
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical:     12  QuartzCore                          0x000000018734d030 <redacted> + 92
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical:     13  CoreFoundation                      0x00000001831d2910 <redacted> + 32
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical:     14  CoreFoundation                      0x00000001831d0238 <redacted> + 412
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical:     15  CoreFoundation                      0x00000001831d0884 <redacted> + 1436
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical:     16  CoreFoundation                      0x00000001830f0da8 CFRunLoopRunSpecific + 552
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical:     17  GraphicsServices                    0x00000001850d6020 GSEventRunModal + 100
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical:     18  UIKit                               0x000000018d110758 UIApplicationMain + 236
2018-08-14 13:46:04.664 MC_Phone.iOS[1943:245399] critical:     19  libXamarin.iOS.dll.dylib            0x00000001034cb8f0 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 368
2018-08-14 13:46:04.664 MC_Phone.iOS[1943:245399] critical:     20  libXamarin.iOS.dll.dylib            0x000000010345765c UIKit_UIApplication_Main_string___intptr_intptr + 44
2018-08-14 13:46:04.664 MC_Phone.iOS[1943:245399] critical:     21  libXamarin.iOS.dll.dylib            0x000000010345761c UIKit_UIApplication_Main_string___string_string + 172
2018-08-14 13:46:04.665 MC_Phone.iOS[1943:245399] critical:     22  libMC_Phone.iOS.exe.dylib           0x0000000100f820b4 MC_Phone_iOS_Application_Main_string__ + 164
2018-08-14 13:46:04.665 MC_Phone.iOS[1943:245399] critical:     23  libmscorlib.dll.dylib               0x0000000101312f28 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 248
2018-08-14 13:46:04.665 MC_Phone.iOS[1943:245399] critical:     24  libmonosgen-2.0.dylib               0x0000000104cb9778 mono_jit_runtime_invoke + 904
2018-08-14 13:46:04.665 MC_Phone.iOS[1943:245399] critical:     25  libmonosgen-2.0.dylib               0x0000000104d388a4 mono_runtime_invoke_checked + 148
2018-08-14 13:46:04.666 MC_Phone.iOS[1943:245399] critical:     26  libmonosgen-2.0.dylib               0x0000000104d3e61c mono_runtime_exec_main_checked + 120
2018-08-14 13:46:04.666 MC_Phone.iOS[1943:245399] critical:     27  libmonosgen-2.0.dylib               0x0000000104c9b608 mono_jit_exec + 268
2018-08-14 13:46:04.666 MC_Phone.iOS[1943:245399] critical:     28  libxamarin-debug.dylib              0x0000000104fe0cd8 xamarin_main + 2220
2018-08-14 13:46:04.666 MC_Phone.iOS[1943:245399] critical:     29  MC_Phone.iOS                        0x0000000100f33784 MC_Phone.iOS + 210820
2018-08-14 13:46:04.667 MC_Phone.iOS[1943:245399] critical:     30  libdyld.dylib                       0x0000000182b81fc0 <redacted> + 4
2018-08-14 13:46:04.667 MC_Phone.iOS[1943:245399] critical: 
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Here is the main page layout

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:local="clr-namespace:MC_Phone.Views;assembly=MC_Phone"
         x:Class="MC_Phone.TabbedPage1">
<NavigationPage Title="Investor" Icon="investor.png">
    <x:Arguments>
        <local:InvestorPage />
    </x:Arguments>
</NavigationPage>

<NavigationPage Title="Portfolio" Icon="portfolio.png">
    <x:Arguments>
        <local:TotalAllocationPage />
    </x:Arguments>
</NavigationPage>

<NavigationPage Title="Results" Icon="results.png">
    <x:Arguments>
        <local:ResultPage />
    </x:Arguments>
</NavigationPage>

<NavigationPage Title="Growth" Icon="growth.png">
    <x:Arguments>
        <local:MCSimulationPage />
    </x:Arguments>
</NavigationPage>

<NavigationPage Title="Asset Allocation" Icon="assetAlloc.png">
    <x:Arguments>
        <local:AssetAllocationPage />
    </x:Arguments>
</NavigationPage>

<NavigationPage Title="Description" Icon="description.png">
    <x:Arguments>
        <local:DescriptionPage />
    </x:Arguments>
</NavigationPage>

<NavigationPage Title="Disclaimer" Icon="disclaimer.png">
    <x:Arguments>
        <local:DisclaimerPage/>
    </x:Arguments>
</NavigationPage>

<NavigationPage Title="Data Sources" Icon="dataSources.png">
    <x:Arguments>
        <local:DataSourcesPages/>
    </x:Arguments>
</NavigationPage>

<NavigationPage Title="About" Icon="about.png">
    <x:Arguments>
        <local:AboutPage/>
    </x:Arguments>
</NavigationPage>
</TabbedPage>

Here is the extension of the main page that implements all the pages.

namespace MC_Phone
{
    public class MainPage : TabbedPage
    {
        public MainPage()
        {
            Page investorPage, totalAllocationPage, resultPage, mcSimulationPage, assetAllocationPage, descriptionPage = null;

            switch (Device.RuntimePlatform)
            {
                case Device.iOS:
                    investorPage        = new NavigationPage(new InvestorPage())
                    {
                        Title = "Investor"
                    };

                    totalAllocationPage = new NavigationPage(new TotalAllocationPage())
                    {
                        Title = "Total Allocation"
                    };

                    resultPage          = new NavigationPage(new ResultPage())
                    {
                        Title = "Result"
                    };

                    mcSimulationPage    = new NavigationPage(new MCSimulationPage())
                    {
                        Title = "MCSimulation"
                    };

                    assetAllocationPage = new NavigationPage(new AssetAllocationPage())
                    {
                        Title = "Asset Allocation"
                    };

                    descriptionPage = new NavigationPage(new DescriptionPage())
                    {
                        Title = "Description"
                    };
                    break;
                default:
                    investorPage        = new InvestorPage()
                    {
                        Title = "Investor"
                    };

                    totalAllocationPage = new TotalAllocationPage()
                    {
                        Title = "Total Allocation"
                    };

                    resultPage          = new ResultPage()
                    {
                        Title = "Result"
                    };

                    mcSimulationPage    = new MCSimulationPage()
                    {
                        Title = "MCSimulation"
                    };

                    assetAllocationPage = new AssetAllocationPage()
                    {
                        Title = "Asset Allocation"
                    };
                    descriptionPage = new DescriptionPage()
                    {
                        Title = "Description"
                    };
                    break;
            }

            Children.Add(investorPage);
            Children.Add(totalAllocationPage);
            Children.Add(resultPage);
            Children.Add(mcSimulationPage);
            Children.Add(assetAllocationPage);
            Children.Add(descriptionPage);

            List<ToolbarItem> toolbarItems = new List<ToolbarItem>()
            {
                new ToolbarItem{ Text = "Run"},
                new ToolbarItem{ Text = "Clear"}
            };

            if (Device.RuntimePlatform != Device.iOS)
            {
                Title = Children[0].Title;
            }
        }
    }
}

Here is the app.xaml.cs

namespace MC_Phone
{
    public partial class App : Application
    {
        public static bool IsIOS;
        public static TabbedPage TabbedPage;
        public App()
        {
            InitializeComponent();

            TabbedPage = new TabbedPage1();
            MainPage = TabbedPage;
        }
    }
}

How would I alter my code so that the app does not freeze when moving between navigation pages?

Peter Cardenas
  • 508
  • 4
  • 13
  • 1
    how are you switching pages? – Jason Aug 14 '18 at 21:12
  • There are navigation pages at the bar at the bottom which when clicked lead to content pages – Peter Cardenas Aug 14 '18 at 21:33
  • 1
    Please show the relevant code – Jason Aug 14 '18 at 21:37
  • 1
    @TheAwesomePie I see a couple of mistakes IMHO, but first, can you tell me what are you trying to achieve exactly? Regarding "I see in other posts similar to this, there is a view controller involved. Am I supposed to implement one? Where and how would I implement one?", short answer is no you usually shouldn't worry about `ViewController` while working with Xamarin.Forms – Khaled Gaber Aug 15 '18 at 08:20
  • I want the program to stop freezing when I switch between pages.I wasn't sure what ViewController was and if I needed it that's why I mentioned it. – Peter Cardenas Aug 16 '18 at 11:58

0 Answers0