Monitoring applications using `-[NSObject addObserver:forKeyPath:options:context:]` or `observe (_:options:changeHandler:)` will crash if monitor it with Instruments Leaks.

Originator:kishikawakatsumi
Number:rdar://39478939 Date Originated:April 17 2018
Status:Open Resolved:
Product:Xcode Product Version:Xcode 9.3 (9E145)/Xcode 9.4 beta (9Q1004a)
Classification:Bug Reproducible:Always
 
Summary:
When an application calls `[NSObject addObserver:forKeyPath:options:context:]` or `observe (_:options:changeHandler:)` and it is monitored by Instruments Leaks, it will crash.

Steps to Reproduce:
1. Open the project that I attached.
2. Product>Build>For Profiling
3. Product>Perform Action>Profile Without Building
4. Select "Leaks" in "Instruments"
5. Press "Record" button to begin profiling...
6. The app will crash

Expected Results:
No crash and can be monitored memory leaks

Actual Results:
An app will crash

Version/Build:
Xcode 9.3 (9E145)
Xcode 9.4 beta (9Q1004a)

Configuration:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!