Bug 32289 - UIScreen.MainScreen.NativeScale call crashed app
Summary: UIScreen.MainScreen.NativeScale call crashed app
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.3.3
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-22 04:37 UTC by Paul
Modified: 2016-04-11 09:13 UTC (History)
2 users (show)

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


Attachments
Demo project to repro (157.74 KB, application/zip)
2015-07-22 04:37 UTC, Paul
Details
Reapcked project to repro (156.73 KB, application/x-zip-compressed)
2015-07-22 11:01 UTC, Paul
Details


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:
Status:
RESOLVED FIXED

Description Paul 2015-07-22 04:37:43 UTC
Created attachment 12150 [details]
Demo project to repro

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            var x = UIScreen.MainScreen.NativeScale;

            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }

App will crash on var x declaration when running on iPhone 4 with iOS 7.

Mac OS X: 10.9.4
Xamarin Studio: 5.9.4 build 5
Xamarin.iOS: 8.10.2.37
XCode: 6.2 (6776)
iPhone 4, iOS 7.1.2

Xamarin.Forms version=1.3.3.6323

Stacktrace:

  at ObjCRuntime.Runtime.ThrowNSException (IntPtr ns_exception) [0x00000] in /Users/builder/data/lanes/1880/ef8c2f77/source/maccore/src/ObjCRuntime/Runtime.cs:167 
  at ObjCRuntime.Runtime.throw_ns_exception (IntPtr exc) [0x00000] in <filename unknown>:0 
  at (wrapper native-to-managed) ObjCRuntime.Runtime:throw_ns_exception (intptr)
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/1880/ef8c2f77/source/maccore/src/UIKit/UIApplication.cs:63 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Users/builder/data/lanes/1880/ef8c2f77/source/maccore/src/UIKit/UIApplication.cs:46 
  at UIScreen_NativeScale.iOS.Application.Main (System.String[] args) [0x00008] in /Users/admin/Projects/UIScreen_NativeScale/iOS/Main.cs:17
Comment 1 Chris King 2015-07-22 10:52:19 UTC
Thanks for taking the time to submit this bug. Please repackage the repro so it's simply zipped and not wrapped twice and we'll take a look at it. 

Warm regards,
XFT
Comment 2 Paul 2015-07-22 11:01:09 UTC
Created attachment 12160 [details]
Reapcked project to repro

I've repack demo proj
Comment 3 Jason Smith [MSFT] 2016-04-11 09:13:09 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team