tbaggett / xfgloss

New styling properties for standard Xamarin.Forms controls
Other
160 stars 25 forks source link

Object reference error on iPad Only #9

Closed LuigiMaestrelli closed 7 years ago

LuigiMaestrelli commented 7 years ago

I'm getting this error on iOS just when I try to deploy to a real device.

For some reason on XFGlossContentPageRenderer.ViewDidLayoutSubviews the NativeView property is null.

Is anyone having this error?

Object reference not set to an instance of an object (System.NullReferenceException)
  at XFGloss.iOS.Views.XFGlossGradientLayer.GetGradientLayer (UIKit.UIView view) [0x00000] in <b880fe36f9644f1bba52b7a93270c77f>:0 
  at XFGloss.iOS.Renderers.XFGlossContentPageRenderer.ViewDidLayoutSubviews () [0x00006] in <b880fe36f9644f1bba52b7a93270c77f>:0 
  at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend_CGRect (intptr,intptr,CoreGraphics.CGRect)
  at UIKit.UIView.set_Frame (CoreGraphics.CGRect value) [0x00010] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/build/ios/native/UIKit/UIView.g.cs:3137 
  at Xamarin.Forms.Platform.iOS.ChildViewController.ViewDidLayoutSubviews () [0x0000e] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\TabletMasterDetailRenderer.cs:17 
  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/3969/44931ae8/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/3969/44931ae8/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at Useall.Useall.UseApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Desenvolvimento\Useall.Useall\Useall.Useall.UseApp\Useall.Useall.UseApp\Useall.Useall.UseApp.iOS\Main.cs:12 
tbaggett commented 7 years ago

Hi Luigi, I will test this and get back to you. Thanks for letting me know about the issue.

tbaggett commented 7 years ago

I added protection against race conditions where the XF NativeView property hasn't yet been initialized. A new build is available for testing through my CI deployment to myGet - http://myget.org/feed/ansuria-ci/package/nuget/Ansuria.XFGloss.

Can you add MyGet to your NuGet sources and try the v1.0.5.39 package? In Xamarin Studio on the Mac, open preferences and navigate to NuGet - Sources. Add "https://www.myget.org/F/ansuria-ci/api/v2" as a new source. Visual Studio should offer similar options if you're using that instead.

Once the path is added, you should see an update is available for XFGloss. Please update the package in both your PCL and iOS projects, then perform a full rebuild, before testing.

I will push a new release to NuGet once you've verified the issue is fixed. Thanks again for reporting the problem.

LuigiMaestrelli commented 7 years ago

Hi @tbaggett

I tested with the new version and it is working great now.

Thank you.

tbaggett commented 7 years ago

Awesome! I will tag and push the new version to Nuget for release. Thanks for letting me know.