Bug 23362 - Issue with AVPlayer.AddObserver
Summary: Issue with AVPlayer.AddObserver
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.2.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-09-25 02:32 UTC by James Clancey
Modified: 2014-09-25 14:00 UTC (History)
2 users (show)

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:

Description James Clancey 2014-09-25 02:32:59 UTC
This object has not been garbage collected. I hold an instance to it, but When the observed value changes the app blows up with the following error:

Failed to marshal the Objective-C object 0x80a8d840 (type: __XamarinObjectObserver). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Foundation.NSObject+Observer' does not have a constructor that takes one IntPtr argument).
Additional information:
	Selector: observeValueForKeyPath:ofObject:change:context:
	Method: Foundation.NSObject/Observer:ObserveValue (Foundation.NSString,Foundation.NSObject,Foundation.NSDictionary,intptr)

=== Xamarin Studio ===

Version 5.5 (build 198)
Installation UUID: 52089b5f-87fd-4a01-8acf-c63eac855683
	Mono 3.10.0 ((detached/ac51002)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000016

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/Clancey/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.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b23)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b22, mixed mode)

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 973f8d4
Build date: 2014-09-17 17:40:20-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 505000198
Git revision: 7495942eb76d6b80c460ddd61f2b94cba1a97fa2
Build date: 2014-09-18 09:50:12-04
Xamarin addins: c571b625445d60f2c8b189b309a6ffc87386caed

=== Operating System ===

Mac OS X 10.10.0
Darwin Jamess-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0
    Sun Sep  7 19:47:26 PDT 2014
    root:xnu-2782.1.96~4/RELEASE_X86_64 x86_64
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-09-25 10:56:00 UTC
Can you attach the project?
Comment 2 James Clancey 2014-09-25 14:00:26 UTC
Actually I think everything is ok,  I didn't realize AddObserver now returns an IDisposable that I need to retain.