c# - Xamarin.IOS MvvmCross App throws NullReference Exception in ViewDidLoad method in iOS9 -


i working on existing xamarin ios application pcl , uses mvvmcross ioc , databinding. built on mvvmcross 3.1.1

the app looks tabcontrol app buttons on mainviewcotnroller giving tab feel it. views declared in storyboard , in mainviewcontroller,

prepareforsegue(uistoryboardsegue segue, nsobject sender) method

is overridden load selected "tab" view based on segue selected - below

  if (segue.identifier == "firstsegue")  {      var dest = segue.destinationviewcontroller firstview;      dest.request = new mvxviewmodelrequest<firstviewmodel>(null, null, new mvxrequestedby());      foreach (uiview v in src.placeholderview.subviews)      {          v.removefromsuperview();      }      dest.view.frame = new cgrect(0f, 0f, w, h);      src.placeholderview.add(dest.view);  } 

the app runs fine on iphones ios 7.1 till 8.4.

just before ios 9 released did test installation app on iphone 6 ios 9.1 beta , app crashed on loading. retrieved device logs (below) , analysed problem in guts of mvvmcross viewdidload method. updated latest sdks (xcode 7, xamarin.ios 9.0) , followed instructions provided xamarin , compiled app again using latest sdks same error. updated nuget package reference mvvmcross 3.5.1 , still same issue

the issues there null reference @ line 44 in the 3.5 mvvmcross source code in github

note: piece of code has not changed since 3.1 @ least , 3.5.1 latest in nuget mvvmcross

stack trace below (app names, project names changed security reasons):

   2015-09-21 11:06:26.991 myapp[1210:60b] unhandled managed exception: object reference not set instance of object (system.nullreferenceexception)   @ cirrious.crosscore.mvx.resolve[imvxviewmodelloader] () [0x00006] in <filename unknown>:0    @ cirrious.mvvmcross.touch.views.mvxviewcontrollerextensionmethods.loadviewmodel (imvxtouchview touchview) [0x00057] in <filename unknown>:0    @ cirrious.mvvmcross.views.mvxviewextensionmethods.onviewcreate (imvxview view, system.func`1 viewmodelloader) [0x00012] in <filename unknown>:0    @ cirrious.mvvmcross.touch.views.mvxviewcontrollerextensionmethods.onviewcreate (imvxtouchview touchview) [0x00001] in <filename unknown>:0    @ cirrious.mvvmcross.touch.views.mvxviewcontrolleradapter.handleviewdidloadcalled (system.object sender, system.eventargs e) [0x00007] in <filename unknown>:0    @ (wrapper delegate-invoke) <module>:invoke_void_object_eventargs (object,system.eventargs)   @ cirrious.crosscore.core.mvxdelegateextensionmethods.raise (system.eventh andler eventhandler, system.object sender) [0x00004] in <filename unknown>:0    @ cirrious.crosscore.touch.views.mvxeventsourcetableviewcontroller.viewdidload () [0x00006] in <filename unknown>:0    @ myproject.touch.mostpurchasedview.viewdidload () [0x00048] in d:\working\repo\myapp\<myprojectname>\myproject.touch\views\oneoftheview.cs:31    @ (wrapper managed-to-native) objcruntime.messaging:intptr_objc_msgsendsuper (intptr,intptr)   @ uikit.uiviewcontroller.get_view () [0x00030] in /users/builder/data/lanes/2077/d230615b/source/maccore/src/build/ios/native/uikit/uiviewcontroller.g.cs:2632    @ myproject.touch.homeviewcontroller.prepareforsegue (uikit.uistoryboardsegue segue, foundation.nsobject sender) [0x0016a] in d:\working\repo\myapp\myproject.mobile\myproject.touch\homeviewcontroller.cs:335    @ (wrapper managed-to-native) uikit.uiapplication:uiapplicationmain (int,string[],intptr,intptr)   @  uikit.uiapplication.main (system.string[] args, intptr principal, intptr delegate) [0x00005] in /users/builder/data/lanes/2077/d230615b/source/maccore/src/uikit/uiapplication.cs:74    @ uikit.uiapplication.main (system.string[] args, system.string principalclassname, system.string delegateclassname) [0x0001c] in /users/builder/data/lanes/2077/d230615b/source/maccore/src/uikit/uiapplication.cs:57    @ myproject.touch.application.main (system.string[] args) [0x00001] in d:\working\repo\myapp\myproject.mobile\myproject.touch\main.cs:16  2015-09-21 11:06:26.994 myapp[1210:60b] critical: stacktrace: native stacktrace: ..... 

i tried above calling below in view.cs:

    public override void viewdidload()     {         try         {             base.viewdidload();         }         catch (exception ex)         {            // throw toast msg in ui                     }     } 

i disabled base.viewdidload() in view.cs files in viewdidload override methods take next level , same problem inside constructor of mvxsimpletableviewsource class

device log below:

object reference not set instance of object (system.nullreferenceexception)       @ cirrious.crosscore.mvx.tryresolve[imvxtouchsystem] (imvxtouchsystem& service) [0x00006] in <filename unknown>:0        @ cirrious.crosscore.touch.platform.mvxiosmajorversionchecker.readisiosversionorhigher (int32 target, boolean defaultvalue) [0x00000] in <filename unknown>:0        @ cirrious.crosscore.touch.platform.mvxiosmajorversionchecker..ctor (int32 major, boolean defaultvalue) [0x00006] in <filename unknown>:0        @ cirrious.mvvmcross.binding.touch.views.mvxsimpletableviewsource..ctor (uikit.uitableview tableview, system.string nibname, system.string cellidentifier, foundation.nsbundle bundle) [0x00000] in <filename unknown>:0        @ myproject.touch.mostpurchasedview.viewdidload () [0x00059] in d:\working\repo\myapp\myproject.mobile\myproject.touch\views\oneoftheview.cs:42        @ (wrapper managed-to-native) objcruntime.messaging:intptr_objc_msgsendsuper (intptr,intptr)       @ uikit.uiviewcontroller.get_view () [0x00030] in /users/builder/data/lanes/2077/d230615b/source/maccore/src/build/ios/native/uikit/uiviewcontroller.g.cs:2632        @ myproject.touch.homeviewcontroller.prepareforsegue (uikit.uistoryboardsegue segue, foundation.nsobject sender) [0x0016a] in d:\working\repo\myapp\myproject.mobile\myproject.touch\homeviewcontroller.cs:343        @ (wrapper managed-to-native) uikit.uiapplication:uiapplicationmain (int,string[],intptr,intptr)       @ uikit.uiapplication.main (system.string[] args, intptr principal, intptr delegate) [0x00005] in /users/builder/data/lanes/2077/d230615b/source/maccore/src/uikit/uiapplication.cs:74        @ uikit.uiapplication.main (system.string[] args, system.string principalclassname, system.string delegateclassname) [0x0001c] in /users/builder/data/lanes/2077/d230615b/source/maccore/src/uikit/uiapplication.cs:57        @ myproject.touch.application.main (system.string[] args) [0x00001] in d:\working\repo\myapp\myproject.mobile\myproject.touch\main.cs:16  

in short :

only in ios 9.1, mvvmcross 3.1.1 , mvvmcross 3.5.1 has nullreference issue in line 44 of mvxviewcontrollerextensionmethods class gets called during viewdidload works ios 8.4 , below

i getting familiar mvvmcross framework , unsure whether issue mvvmcross , ios 9.

has come across issue? on appreciated.

note: mvvmcross samples work fine ios9. believe has tab implementation.

one thing mvvmcross 3.1.1 not build ios unified code. prevent submitting app. mvvmcross 4.0 in beta, recommend using it, because has many fixes.

if code crashes on line 44 while trying resolve imvxviewmodelloader, means missing package imvxviewmodelloader is.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -