Bug 34220 - ReplayKit causes InvalidCastException on iOS 9
Summary: ReplayKit causes InvalidCastException on iOS 9
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 9.0 (iOS9)
Hardware: PC Mac OS
: Normal normal
Target Milestone: 9.0.2 (iOS9SR1)
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2015-09-23 17:59 UTC by Cody Beyer (MSFT)
Modified: 2015-10-09 10:57 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:
VERIFIED FIXED

Description Cody Beyer (MSFT) 2015-09-23 17:59:59 UTC
### Description

Using ReplayKit on iOS 9 appears to cause an InvalidCastException when recording ends

### Sample

https://www.dropbox.com/s/q4e3eklr17nw4b5/ReplayKitCrash.zip?dl=0

### Error

https://gist.github.com/CodyBeyer/3802ae9c840438175b12

### Steps to Reproduce

1. Download, unzip and open ReplayKitCrash.sln
2. Compile and Start Debugging on device 
3. Touch any part of the black background, this should bring up the ReplayKit permission UI
4. Select "Record Screen Only" (If you select Record Screen & Microphone the UI won't appear the next time you try)
5. Touch any part of the black background after a few seconds

### Expected Results

Replay recording should end

### Actual Results

Above linked error is thrown

### Versions

=== Xamarin Studio ===

Version 5.9.7 (build 9)
Installation UUID: 852fb169-eb98-4eeb-93fb-5f54eb55f790
Runtime:
	Mono 4.0.4 ((detached/cb6d6b2)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040002

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.iOS ===

Version: 9.0.1.20 (Business Edition)
Hash: d8e9592
Branch: master
Build date: 2015-09-18 23:22:05-0400

=== Xamarin.Android ===

Version: 5.1.6.7 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.2.111 (Business Edition)

=== Build Information ===

Release ID: 509070009
Git revision: 31fa64709030b3edb971237780a452a4c69943c4
Build date: 2015-09-17 11:44:37-04
Xamarin addins: b105d33d8cd72911ff2cf3ee0b7715d37e5f19a6

=== Operating System ===

Mac OS X 10.10.5
Darwin BeyerStudiosMac.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 1 Sebastien Pouliot 2015-09-24 09:15:25 UTC
This can be duplicate with maccore/master too
Comment 2 Sebastien Pouliot 2015-09-24 09:31:57 UTC
The handler signature is incorrect. It probably changed during the betas and this handlers signature changes are not something our API tests catch.
Comment 3 Sebastien Pouliot 2015-09-24 09:53:55 UTC
Fixed in maccore/master dfa21c91d2c301202368bcc0bba3637fe8c6f2ef

Candidate for SR1 https://trello.com/c/QwBbqnZh/25-bug-34200-incorrrect-signature-in-rpscreenrecorder
Comment 4 GouriKumari 2015-09-24 16:52:55 UTC
I verified this issue with Xamarin.iOS master Xamarin.iOS
Version: 9.3.0.84 (Enterprise Edition)
Hash: dfa21c9.

Test Results:
I could reproduce the issue with the current stable 9.0.1.20.pkg
StackTrace: https://gist.github.com/GouriKumari/d3333074faaa3f59e2c4

With fix:
I couldn't reproduce the invalid cast exception. But, continuously got "2015-09-24 16:42:33.063 ReplayKitCrash[1666:1375455] -[UIWindow endDisablingInterfaceAutorotationAnimated:] called on <UIWindow: 0x15cd79790; frame = (0 0; 320 568); autoresize = W+H; gestureRecognizers = <NSArray: 0x15cd7ab30>; layer = <UIWindowLayer: 0x15cd791f0>> without matching -beginDisablingInterfaceAutorotation. Ignoring."

Application Output:
https://gist.github.com/GouriKumari/aa759a08818dec8846b2
Comment 5 Sebastien Pouliot 2015-09-24 17:40:36 UTC
I did not see those messages (but I did not really look for any either) but they are not related to the fix.

Those looks like a sample issue (they are not API that XI calls by itself),
Comment 6 Philippe Rollin 2015-10-05 15:15:04 UTC
The issue seem to be fixed with the latest stable release on OSX but remains when using Visual Studio. It seems that the signature of RPScreenRecorder.StopRecording() is still missing a parameter when compiling using Xamarin for Visual Studio. Below is the version information of my setup.

Microsoft Visual Studio Community 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.6.00079

Xamarin   3.11.1443.0 (39031d3)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.6.7 (58099c5358da3488b0e7fb0bb4af47aca7cc61d6)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   9.0.1.0 (7eaf3bc2053ad0d4f720422bb3dc13504d61f7b5)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 7 Sebastien Pouliot 2015-10-05 15:20:42 UTC
@Philippe XVS 3.11.1450 should be the matching version and available (like XI's 9.0.1.29) on the beta channel.
Comment 8 Philippe Rollin 2015-10-05 16:32:10 UTC
I tried the beta channel and I am getting the same issue (works in Xamarin Studio on OSX)
Comment 9 Sebastien Pouliot 2015-10-05 16:36:48 UTC
@Joe any clue why ?
Comment 10 Shruti 2015-10-09 10:57:30 UTC
Reproduced with iOS 9 build: Xamarin.iOS Version: 9.0.1.20 
Screencast: http://www.screencast.com/t/yAhAytyWt3P

I am able to Verified with iOS  9 builds Xamarin.iOS
Version: 9.0.1.29 (Business Edition)
Hash: 1d27ac2
Branch: master
Build date: 2015-09-25 18:08:44-0400
app output: https://gist.github.com/Arpit360/a92bb6481a399c51c1be
Screencast: http://www.screencast.com/t/csjSU306GQvk

Verified with Cycle 6 builds  Xamarin.iOS
Version: 9.2.0.85 (Business Edition)
Hash: 7bcf0da
Branch: master
Screencast: http://www.screencast.com/t/RB9l2LePig3J
app output: https://gist.github.com/Arpit360/6a0f871b8b938e02ffa1

Enviroment Info:
https://gist.github.com/Arpit360/219f664f898bf6135bd4

Note: we are able to reproduce this issue on iPhone 6+ iOS 9.1