Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 for Bug 52476 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 19801 [details]
A Sample project, its screenshot and its log
Xamarin provides users the following lambda style AddObserver() of KVO.
Disposable = PlayerItem.AddObserver("status", NSKeyValueObservingOptions.New, (obj) =>
I think it causes crash when it is disposed.
Run the attached sample project and do the following steps:
1. Tap “Hello World, Click Me!” button and show a scene of PlayerViewController
2. Tap “Dismiss” button and dismiss the scene
After 2nd step, the app crashes with this error message:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: An instance 0x608000019a80 of class AVPlayerItem was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x61800023f500> (
<NSKeyValueObservance 0x618000242160: Observer: 0x61800023d780, Key path: status, Options: <New: YES, Old: NO, Prior: NO> Context: 0x61800023d780, Property: 0x618000242190>
If you use the way of normal AddObserver, this crash doesn’t happen.
In my sample project, you can see the differences of them with switching the value of the property “UsesLambdaWay” of PlayerViewController to “false" from “true”.
I attached the animated gif of the screenshot and its full log.
Check it as well ;)
=== Xamarin Studio Professional ===
Version 6.2 (build 1809)
Installation UUID: 06c49475-4597-4e61-8ea9-83db8732bbe1
Mono 4.8.0 (mono-4.8.0-branch/ba7f169) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 408000483
=== NuGet ===
=== Xamarin.Profiler ===
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 8.2.1 (11766.1)
=== Xamarin.iOS ===
Version: 10.4.0.114 (Visual Studio Professional)
Build date: 2017-02-03 16:04:59-0500
=== Xamarin.Android ===
Version: 18.104.22.168 (Visual Studio Professional)
Android SDK: Not found
=== Xamarin Android Player ===
=== Xamarin.Mac ===
Version: 22.214.171.1244 (Visual Studio Professional)
=== Xamarin Inspector ===
Build date: Tue, 15 Nov 2016 21:13:59 GMT
=== Build Information ===
Release ID: 602001809
Git revision: bd75dae9aa2e6041309bc6a4f6140cc099ea2e98
Build date: 2017-02-03 15:04:22-05
Xamarin addins: bf31ec767f2a60b3e34647baf33798b26c9336aa
Build lane: monodevelop-lion-cycle9
=== Operating System ===
Mac OS X 10.11.6
Darwin abc.local 15.6.0 Darwin Kernel Version 15.6.0
Mon Jan 9 23:07:29 PST 2017
Looks like you're right, it crashes when you try to dispose of it without first removing the observer, and there doesn't appear to be a way to remove an observer that was added using a lambda expression.