Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix for InvalidOperationException when iOS app starts #514

Merged
merged 1 commit into from
Mar 21, 2018

Conversation

chrisstaley
Copy link
Contributor

The Exception occurs when the iOS app launches. It is due to NavigationPage being rendered before the root view has been set. Android applications are not affected since the root page check occurs in platform-specific code.

Exception details are:

NavigationPage must have a root Page before being used. Either call PushAsync with a valid Page, or pass a Page to the constructor before usage. (System.InvalidOperationException)
at Xamarin.Forms.Platform.iOS.NavigationRenderer.ViewDidLoad () <0x10115fc60 + 0x0071c> in <bc5a3d4303744676b3b36f4254bb697d#fcf3a1c8209da1af9ec91eac76a1af7b>:0
at (wrapper managed-to-native) ObjCRuntime.Messaging:objc_msgSendSuper (intptr,intptr)
at UIKit.UIViewController.get_View () <0x100a62790 + 0x00073> in <e0596b82250c450abdf075bc558add28#fcf3a1c8209da1af9ec91eac76a1af7b>:0
at Xamarin.Forms.Platform.iOS.NavigationRenderer.get_NativeView () <0x10115ef90 + 0x0001b> in <bc5a3d4303744676b3b36f4254bb697d#fcf3a1c8209da1af9ec91eac76a1af7b>:0
at Xamarin.Forms.Platform.iOS.NavigationRenderer.SetElement (Xamarin.Forms.VisualElement element) <0x10115efc0 + 0x000bb> in <bc5a3d4303744676b3b36f4254bb697d#fcf3a1c8209da1af9ec91eac76a1af7b>:0
at Xamarin.Forms.Platform.iOS.Platform.CreateRen<\M-b\M^@\M-&>

For iOS, you must wait to set the application's MainPage property until after the NavigationPage's root view has been set (which is handled by the call to navigationService.NavigateToViewAsync()).

Exception is due to NavigationPage being rendered before the root view has been set
@nigel-sampson nigel-sampson merged commit cc8718a into Caliburn-Micro:dev/4.0.0 Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants