Bug 50331 - iOS - Adding Label to a page causes Exception - Method 'CGSize..ctor' not found.
Summary: iOS - Adding Label to a page causes Exception - Method 'CGSize..ctor' not found.
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-12-18 14:53 UTC by Ido Shviro
Modified: 2017-01-12 14:17 UTC (History)
6 users (show)

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

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 Ido Shviro 2016-12-18 14:53:18 UTC
In Xamarin.Forms version 2.3 or higher, 
Adding a Label to a page causes System.MissingMethodException: Method 'CGSize..ctor' not found
this is happening only in iOS.
In version 2.2.0.45 it's not happening!

this bug was fixed and returned!
https://bugzilla.xamarin.com/show_bug.cgi?id=41368

This bug in xamarin forums:
https://forums.xamarin.com/discussion/67752/method-cgrect-ctor-not-found-exception-after-upgrading-to-xamarin-forms-version-2-2-0-43

StackTrace:

{System.MissingMethodException: Method 'CGSize..ctor' not found.
  at Xamarin.Forms.Platform.iOS.LabelRenderer.LayoutSubviews () [0x0002e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\LabelRenderer.cs:49 
  at XXXMobile.iOS.Controls.HLabelRenderer.LayoutSubviews () [0x00001] in C:\Projects\XXX.Mobile\XXXXamarin\XXXMobile\XXXMobile.iOS\Controls\HLabelRenderer.cs:19 
  at Xamarin.Forms.Platform.iOS.LabelRenderer.UpdateText () [0x00095] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\LabelRenderer.cs:165 
  at Xamarin.Forms.Platform.iOS.LabelRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1 e) [0x0002b] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\LabelRenderer.cs:75 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (Xamarin.Forms.Platform.iOS.TElement element) [0x00110] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:157 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:106 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:283 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x00009] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:63 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:36 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (Xamarin.Forms.Platform.iOS.TElement element) [0x000cc] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:145 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:106 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:283 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x00009] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:63 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:36 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (Xamarin.Forms.Platform.iOS.TElement element) [0x000cc] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:145 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:106 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:283 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x00009] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:63 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:36 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (Xamarin.Forms.Platform.iOS.TElement element) [0x000cc] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:145 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:106 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:283 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x00009] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:63 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:36 
  at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x00086] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:106 
  at (wrapper managed-to-native) ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
  at UIKit.UIViewController.get_View () [0x00030] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/build/ios/native/UIKit/UIViewController.g.cs:2783 
  at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:42 
  at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0004f] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:57 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001b] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:283 
  at Xamarin.Forms.Platform.iOS.Platform.AddChild (Xamarin.Forms.VisualElement view) [0x00027] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:417 
  at Xamarin.Forms.Platform.iOS.Platform.WillAppear () [0x0003c] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:403 
  at Xamarin.Forms.Platform.iOS.PlatformRenderer.ViewWillAppear (Boolean animated) [0x00010] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\PlatformRenderer.cs:142 
  at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
  at UIKit.UIWindow.MakeKeyAndVisible () [0x00010] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/build/ios/native/UIKit/UIWindow.g.cs:250 
  at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.SetMainPage () [0x00006] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:156 
  at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.FinishedLaunching (UIKit.UIApplication uiApplication, Foundation.NSDictionary launchOptions) [0x00028] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:44 
  at XXXMobile.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app, Foundation.NSDictionary options) [0x0004b] in C:\Projects\XXX.Mobile\XXXXamarin\XXXMobile\XXXMobile.iOS\AppDelegate.cs:31 
  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/3234/d8bedd03/source/maccore/src/UIKit/UIApplication.cs:77 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/UIKit/UIApplication.cs:61 
  at XXXMobile.iOS.Application.Main (System.String[] args) [0x00002] in C:\Projects\XXX.Mobile\XXXXamarin\XXXMobile\XXXMobile.iOS\Main.cs:19 }
Comment 1 Timothy Risi 2016-12-19 19:18:57 UTC
This looks like a bug with Xamarin.Forms itself as opposed to Xamarin.iOS
Comment 2 Ido Shviro 2016-12-20 08:15:34 UTC
okay, can someone fix this?
using a label is really one of the most basic things..
Comment 3 adrianknight89 2016-12-20 23:54:30 UTC
Can you attach a minimal repro?
Comment 4 Ido Shviro 2016-12-21 09:43:21 UTC
just create a new portable forms project in VisualStudio and put a xaml page with a Label:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="HilanMobile.Views.Tests.TestPage">
    <StackLayout >
      <Label Text="Hello World"></Label>
    </StackLayout>
</ContentPage>

in the App class:

public App ()
{
  // The root page of your application
  MainPage = new TestPage();
}

to see the exception - in the iOS Main class:
static void Main(string[] args)
{
  try
  {
    UIApplication.Main(args, null, "AppDelegate");
  }
  catch (Exception ex)
  {
     var exception = ex.ToString();
     throw;
   }
}

as simple as that
Comment 5 Paul DiPietro [MSFT] 2016-12-30 16:45:02 UTC
Are you on Cycle 8? What is your version info?
Comment 6 Ido Shviro 2017-01-03 18:12:08 UTC
I'm not really sure what Cycle 8 mean.
I'm using VisualStudio. This is my version info:

Microsoft Visual Studio Professional 2015
Version 14.0.25123.00 Update 2
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Professional

Visual Basic 2015
Microsoft Visual Basic 2015

Visual C# 2015
Microsoft Visual C# 2015

Visual C++ 2015
Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package   4.3.60226.3
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11106.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Bundler & Minifier   2.2.307
Adds support for bundling and minifying JavaScript, CSS and HTML files in any project.

Common Azure Tools   1.7
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

File Nesting   2.6.67
Automatically nest files based on file name and enables developers to nest and unnest any file manually

JetBrains ReSharper Ultimate 2016.1    Build 105.0.20160414.153548
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60311.1
Microsoft SQL Server Data Tools

TypeScript   1.8.29.0
TypeScript tools for Visual Studio

Visual Studio Tools for Apache Cordova   Update 7
Visual Studio Tools for Apache Cordova

Visual Studio Tools for Universal Windows Apps   14.0.24720.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Web Compiler   1.11.326
Compiler for LESS, Sass and CoffeeScript files

Web Essentials 2015.3   3.0.235
Adds many useful features to Visual Studio for web developers. Requires Visual Studio 2015

Xamarin   4.0.3.214 (0dd817c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.0.3.5 (a94a03b)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   9.6.1.8 (3a25bf1)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 7 Samantha Houts [MSFT] 2017-01-03 20:31:23 UTC
Xamarin.Forms 2.3.3+ requires a later version of the Xamarin platform than you have installed. Please try updating your Xamarin extensions to the latest stable version and let us know if the problem persists.
Comment 8 Ido Shviro 2017-01-12 09:28:42 UTC
I have updated both xamarin extention for visual studio and the xamarin studio in the mac (including iOS SDK) and it solved the problem.
Comment 9 Paul DiPietro [MSFT] 2017-01-12 14:17:35 UTC
Thank you for the update and I'm glad to hear that your problem has been resolved.