Bug 14036 - [Device only] UIView.Frame values are not set correctly when debugging
Summary: [Device only] UIView.Frame values are not set correctly when debugging
Alias: None
Product: iOS
Classification: Xamarin
Component: Debugger ()
Version: 6.4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-08-16 12:32 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-05-14 16:44 UTC (History)
3 users (show)

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

Test case (8.23 KB, application/zip)
2013-08-16 12:32 UTC, Brendan Zagaeski (Xamarin Team, assistant)

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 Brendan Zagaeski (Xamarin Team, assistant) 2013-08-16 12:32:35 UTC
Created attachment 4648 [details]
Test case

## Steps to reproduce
1. Open attached example project
2. Select "Run -> Start Debugging". Run on an iPad.
3. Press the "Dump Frame to Console" button

Tip: if the behavior disappears, try deleting the `obj` and `bin` folders, then manually deleting the app from the device, and then re-deploying.

## Result
The Frame of the `bodyContainer` is reported as "{X=0,Y=0,Width=0,Height=0}"

## Expected Result
The Frame of the `bodyContainer` is "{X=0,Y=0,Width=1024,Height=748}"

## Ways to "fix" the example
A. Run the example using "Run -> Start Without Debugging". The Console log from the device shows the correct Frame size.
B. Remove almost any of the lines of code in `ExampleViewController.cs`.
C. Shorten the "AtLeastEighteenCharacters" namespace to under eighteen characters.

## Changes that don't fix the example
A. Rename the UILabel subclass.
B. Create a new empty iPad project, add `ExampleViewController*` to the project, and add `window.RootViewController = new ExampleViewController ();` to AppDelegate.cs (plus `using AtLeastEighteenCharacters;`). The new project will now show the problem.
C. Change the font argument at ExampleViewController.cs:99, or set the arguments to `("", 0)`, or even replace the whole line with `Font = null;`

Tested on an iPad 3, iOS 6.0
Tested on both Xamarin.iOS 6.4.1 and 6.4.3.
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2013-08-16 13:36:50 UTC
Another work-around that might be informative:

Nest the "Text in a custom label" UICourierLabel within another view (in Xcode Interface Builder: Editor -> Embed in -> View). Then that new subview's Frame will be all zeroes, instead of the original parent view's Frame.

After this change, the view hierarchy will look like:

-  MainViewContainer
--  Button
--  View
---  Courier Label
Comment 5 Sebastien Pouliot 2015-05-14 16:44:54 UTC
This seems to work fine now. Closing