Bug 26532 - Unable to access property values from custom CALayer
Summary: Unable to access property values from custom CALayer
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.6.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
: 27431 ()
Depends on:
Reported: 2015-01-29 02:36 UTC by Prashant Cholachagudda
Modified: 2015-03-03 14:21 UTC (History)
5 users (show)

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

Test case (9.73 KB, application/zip)
2015-01-29 02:36 UTC, Prashant Cholachagudda

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 Prashant Cholachagudda 2015-01-29 02:36:04 UTC
Created attachment 9544 [details]
Test case

We created one class "TextCALayer" which inherit from CALayer. This class contains one property named "Color". 
We create one new TextCALayer object and set a Color. And then add it to RootController's View's sublayers.

TextCALayer textLayer = new TextCALayer("Test String " + i, new CGPoint(0, 0));
textLayer.Color = UIColor.Blue;

And then we try to get this Color for layer item in Layer.Sublayer, place refer below code.
foreach (var textItem in Layer.Sublayers.OfType<TextCALayer>())

We always get no color value when we access `textItem.Color`

Please use attached test case to reproduce the issue. Note that it happens only on a real device and with ObjC project.
Comment 2 Udham Singh 2015-01-29 05:37:14 UTC
I have checked this issue with the help of Test Case given in bug description and able to reproduce this issue. Please refer the screencast : http://www.screencast.com/t/Z9ooBcivCkx

To reproduce this issue I have followed the steps below:

1. Open the Test Case in XS.
2. Run the app on iOS device(iPhone 4S iOS 7.1.2).
3. Click on button 'Refresh'.

Environment Info : 

=== Xamarin Studio ===

Version 5.7.1 (build 15)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 5c4bf93
Build date: 2015-01-27 17:37:50-0500

=== Build Information ===

Release ID: 507010015
Git revision: ce24e991948c7f3d88b0194a14fc1996d848ef51
Build date: 2015-01-26 16:42:20-05
Xamarin addins: 6895e3222bfa6910524708aa0633ff3db99bc3a0

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-01-29 13:33:54 UTC
This is ObjC playing dirty :|

I think I have a fix though.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2015-02-10 08:22:09 UTC

maccore/master: 6c263667734a3039b38e72c2b70b7597673c2d9c
Comment 5 Rolf Bjarne Kvinge [MSFT] 2015-03-03 14:21:01 UTC
*** Bug 27431 has been marked as a duplicate of this bug. ***