Bug 24098 - Photo preview's are black when taken from modal view controller when using Classic API
Summary: Photo preview's are black when taken from modal view controller when using Cl...
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.0.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
: 24266 ()
Depends on:
Blocks:
 
Reported: 2014-10-28 06:27 UTC by Herman Schoenfeld
Modified: 2016-09-12 23:13 UTC (History)
7 users (show)

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


Attachments
Self-contained solution to reproduce bug (90.85 KB, application/zip)
2014-10-28 06:27 UTC, Herman Schoenfeld
Details
Classic test project (56.70 KB, application/zip)
2014-12-17 07:46 UTC, Rolf Bjarne Kvinge [MSFT]
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 NOT_ON_ROADMAP

Description Herman Schoenfeld 2014-10-28 06:27:03 UTC
Created attachment 8526 [details]
Self-contained solution to reproduce bug

When taking a photo from a modally presented view controller, the preview photo is black and the following errors are logged:

Oct 28 20:02:50 X-iPad Bug[431] <Error>: CGAffineTransformInvert: singular matrix.
Oct 28 20:02:50 X-iPad Bug[431] <Error>: CGAffineTransformInvert: singular matrix.
Oct 28 20:02:50 X-iPad Bug[431] <Error>: CGAffineTransformInvert: singular matrix.



This only happens on Classic API in iOS 8. It does not happen on Unified API in iOS 8 or Classic API in iOS 7. Whether you take a photo using UIImagePickerController or Xamarin.Mobile (which uses it transitively), this error occurs.

I've attached a solution to reproduce this bug. It contains two identical iOS projects - one using the classic API (Monotouch_Bug) the other using the Unified API (XamariniOS_Works).

You can reproduce the error via the following steps:
0. Prepare an iOS 8 iPad
1. Compile and run Monotouch_Bug
2. Tap "Show Modal"
3. Tap "Photo Picker"
4. Snap a photo
5. Observe the black photo preview (this should not happen)


If you repeat the above steps but replace step 1 with
1a. Compile and run XamariniOS_Works

you can see that it works fine. Also, if you take a photo without a modal dialog it works in all cases. My guess is that the Classic API has not been properly updated for iOS 8, unlike Unified API and this has slipped through the cracks. Our company is in no position to upgrade to Unified API as we are dealing with a large enterprise project with many customers. As our customers upgrade to iOS 8, they see this issue.
Comment 1 Sunil Kumar 2014-10-28 08:35:50 UTC
I have tried to reproduce this issue and unable to reproduce. I have downloaded the attached sample and followed mentioned steps in bug description to reproduce this issue. I run both project of the solution and gets the same behavior. I run 'Monotouch_Bug' project and observed that we are not getting 'black photo preview' and not any error. We are able to take photo via clicking the "Photo Picker" button from  both screens (without or with using the "Show Model" button) and after taken the snap we are getting taken photo as a preview.

Screencast: http://screencast.com/t/HhYatQ7pq

Please let me know if I have to follow any other steps to reproduce this issue?

Device info:
iPad mini iOS 8
iPad 4 iOS 8.1

Environment info:
=== Xamarin Studio ===

Version 5.5.3 (build 6)
Installation UUID: 2939b8b4-8977-42bd-82d6-100275ccd9cd
Runtime:
	Mono 3.10.0 ((detached/fe854ad)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000025

=== Apple Developer Tools ===

Xcode 6.1 (6602)
Build 6A1052c

=== Xamarin.Android ===

Version: 4.18.1 (Indie Edition)
Android SDK: /Users/360_macmini/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Xamarin.iOS ===

Version: 8.2.0.214 (Indie Edition)
Hash: f45a9be
Branch: 
Build date: 2014-10-28 01:20:23-0400

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:08:38-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Mac OS X 10.9.4
Darwin 360-MACMINIs-Mac-mini-2.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 2 Herman Schoenfeld 2014-10-28 19:43:58 UTC
Device Info:
This issue occurs for us on iPad 2's, iPad Air's & iPad Air 2's on all versions of iOS 8.

Since you are unable to reproduce, it's likely a build issue. The environment which builds the IPA has the below details. It's running the latest alpha. 


Environment Info:

=== Xamarin Studio ===

Version 5.6.2 (build 5)
Installation UUID: aad8e2c1-53aa-4766-af0b-57b0ba105a0e
Runtime:
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.Mac ===

Version:

=== Xamarin.Android ===

Version: 4.99.0 (Starter Edition)
Android SDK: /Users/Developer/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Xamarin.iOS ===

Version: 8.2.0.193 (Business Edition)
Hash: 959c1e4
Branch: 
Build date: 2014-10-03 00:25:37-0400

=== Build Information ===

Release ID: 506020005
Git revision: 19bc3b64b70332bfab18faf9cf1ce7d3aa191b36
Build date: 2014-10-17 14:49:01-04

=== Operating System ===

Mac OS X 10.9.5
Darwin 192-168-1-107.tpgi.com.au 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 Herman Schoenfeld 2014-10-28 20:12:17 UTC
UPDATE: This issue only seems to appear in landscape orientation, not portrait orientation.

This is more likely to be the cause of your inability to reproduce. Please retry in landscape orientation.
Comment 4 Herman Schoenfeld 2014-10-29 00:07:38 UTC
Changing status to NEW
Comment 5 Jatin 2014-11-05 06:03:16 UTC
I have tried to reproduce this issue at my end using the attached sample and according to the steps provided in the original bug on the latest stable build and Xcode 5.1.1 as well as Xcode 6.1

And have observed that per comment #3, this issue exist only release mode and on the landscape orientation only. 

However, on debug mode it is working fine on the both landscape as well as portrait orientation.

Below is the supplement information which we could able to gather:

IDE Logs:  https://gist.github.com/Mohit-Kheterpal/aac0b40ad65241f9c506
Device logs from XS: https://gist.github.com/Mohit-Kheterpal/13aca4e8e150f07bfb71

Note: Not able to get the device logs through Xcode. Hence, provided the device logs from XS. Hoping it will be helpful.

Build information:

=== Xamarin Studio ===

Version 5.5.3 (build 6)
Installation UUID: 45555ffd-f3f0-4f29-9543-e369d711ab7d
Runtime:
 Mono 3.10.0 ((detached/47db868)
 GTK+ 2.24.23 (Raleigh theme)

 Package version: 310000019

=== Xamarin.Android ===

Not Installed

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.4.0.15 (Enterprise Edition)
Hash: 08968c4
Branch: 
Build date: 2014-10-20 21:48:06-0400

=== Xamarin.Mac ===

Version: 1.11.1.89 (Enterprise Edition)

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:08:38-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin77s-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 6 Jatin 2014-11-05 06:07:29 UTC
*** Bug 24266 has been marked as a duplicate of this bug. ***
Comment 8 Jatin 2014-11-18 07:08:06 UTC
Below are the steps in order to reproduce this issue:

1. Download the attached sample
2. Open only MonoTouch_Bug
3. Run it on Release mode targeting iPad with iOS 8
4. As soon as the application launches change the orientation to "Landscape" mode
5. Tap on the Show Modal button.
6. Now Tap on Photo Picker.
7. Snap a Photo
8. Observe the issue stated.

Note: This issue appears on the Release mode, when user try to snap a photo on the Landscape Orientation.

All the other supplement information is provided in the Comment #5

Also screencast is not possible as it is happening only on the Device.

Please let me know if I can provide any other useful information other than that mentioned in the comment #5.
Comment 11 Herman Schoenfeld 2014-11-24 17:38:45 UTC
@John Miller: the bug is definately reproducable as all our enterprise customers are encountering it.

The issue occurs in Landscape orientation only.

Please make sure your testers read every step carefully, perform every step correctly, as the issue is still occuring.

NOTE: the issue will NOT appear when building against unified API or when using Portrait orientation.
Comment 13 Rolf Bjarne Kvinge [MSFT] 2014-11-25 12:05:58 UTC
I'm not able to reproduce either.

Does the same thing happen if you use UIImagePickerController directly like this?

	var p = new UIImagePickerController ();
	p.SourceType = UIImagePickerControllerSourceType.Camera;
	PresentViewController (p, true, null);

Also note Apple's documentation about UIImagePickerController: "The UIImagePickerController class supports portrait mode only." [1]

[1] https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImagePickerController_Class/index.html
Comment 14 Herman Schoenfeld 2014-12-16 18:52:50 UTC
I downloaded the attachment and followed the instructions and reproduced the bug. 

The bug is still present and is easily reproducible with these steps:

1. Compile and run "Monotouch_bug" on iPad Air running iOS 8

2. Orientate the iPad in Landscape mode

3. Tap " Show Modal"

4. Tap "Photo Picker"

5. Take photo

6. Observe black preview image with debug output as follows

2014-12-17 09:42:36.935 Bug[1361:314086] Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
Dec 17 09:42:40 Sphere-10-iPad Bug[1361] <Error>: CGAffineTransformInvert: singular matrix.
Dec 17 09:42:40 Sphere-10-iPad Bug[1361] <Error>: CGAffineTransformInvert: singular matrix.
Dec 17 09:42:40 Sphere-10-iPad Bug[1361] <Error>: CGAffineTransformInvert: singular matrix.



@Rolf:
The code uses Xamarin.Mobile to take the photo which does not provide access to UIImagePickerController.
Comment 15 Herman Schoenfeld 2014-12-16 20:08:54 UTC
THIS ISSUE OCCURS IN CLASSIC API BINDINGS NOT IN UNIFIED API 


PLEASE READ BUG REPORT CAREFULLY. READ EVERY WORD. UNDERSTAND EVERY WORD. RUN EVERY STEP. THE ISSUE EXISTS.
Comment 16 Rolf Bjarne Kvinge [MSFT] 2014-12-17 07:46:00 UTC
Created attachment 9102 [details]
Classic test project

Can you try the attached (Classic) sample, and see if you still get the black screen?
Comment 17 Sebastien Pouliot 2016-09-12 23:13:45 UTC
The classic profile has been deprecated and cannot be used in XI 10+