Bug 44491 - iOS 10 problem with call SetViewControllers method
Summary: iOS 10 problem with call SetViewControllers method
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 10.0 (iOS10)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-09-19 13:45 UTC by Aleksandr
Modified: 2016-11-22 02:22 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Bug files (270.80 KB, application/zip)
2016-09-19 13:45 UTC, Aleksandr

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Aleksandr 2016-09-19 13:45:07 UTC
Created attachment 17587 [details]
Bug files

Problem with navigation in AppDelegate.
This code work in iOS9. For iOS 10 throw NullPointerException

//Crush this for iOS 10
NavController.SetViewControllers(new[] { new LoginViewController() }, true);

Error Stack Trace:

  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at PikComfort.iOS.Application.Main (System.String[] args) [0x00008] in /Users/jasper/Documents/Проекты/PikComfort/PikComfort.iOS/Main.cs:12 

I attach full AppDelegate code

//I found solution. This work for iOS 10
NavController.ViewControllers = new[] { new LoginViewController() };
Comment 1 Alex Soto [MSFT] 2016-09-22 20:33:14 UTC
Hello Aleksandr

I have tried to reproduce the issue but I am not able to, I noticed something in the code file you attached, you have this NavController property inside the AppDelegate but in your code where you have this line commented out

//NavController.SetViewControllers(new[] { ctrl }, true);

if you uncomment it in that particular spot and the condition surrounding it is met, a NullReferenceException is totally expected since the NavController property has not been assigned yet.

Could you please attach a full reproducible test case so we can have reliably reproduce this?

Comment 2 Alex Soto [MSFT] 2016-10-23 23:07:17 UTC
We have not received the requested information. If you are still 
experiencing this issue please provide all the requested information 
and re-open the bug report. Thanks!
Comment 3 Sebastien Pouliot 2016-11-22 02:22:55 UTC
closing based on comment #2