I’ve been using the very handy “expectation” API in XCTestCase, for testing
asynchronous operations. But one particular test is occasionally failing in our
Xcode bot, never for me, with a weird exception. It looks like the
implementation of -keyValueObservingExpectationForObject:… isn’t handling KVO
registration properly:
Assertion: failed: caught "NSRangeException", "Cannot remove an observer
<_XCKVOExpectation 0x1056a00c0> for the key path "fractionCompleted" from
<NSProgress 0x10a01ae90> because it is not registered as an observer."
(
0 CoreFoundation 0x00007fff8ab8403c
__exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff9249c76e
objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ab83eed
+[NSException raise:format:] + 205
3 Foundation 0x00007fff90f5a896
-[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] + 604
4 Foundation 0x00007fff90f5a5d9
-[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] + 114
5 XCTest 0x0000000100099d57
-[_XCKVOExpectation _safelyUnregister] + 96
6 XCTest 0x000000010008eae2
-[_XCTestCaseImplementation resetExpectations] + 231
7 CBL Mac Unit Tests 0x0000000104bf2f5c
-[Replication_Tests test20_LazyPullAttachments] + 10268
8 CoreFoundation 0x00007fff8aa5b7bc
__invoking___ + 140
9 CoreFoundation 0x00007fff8aa5b612
-[NSInvocation invoke] + 290
10 XCTest 0x000000010008b9fc -[XCTestCase
invokeTest] + 253
11 CBL Mac Unit Tests 0x0000000104a78b37
-[CBLTestCaseWithDB invokeTest] + 119
12 CBL Mac Unit Tests 0x0000000104ba7275
-[Replication_Tests invokeTest] + 69
13 XCTest 0x000000010008bbfb -[XCTestCase
performTest:] + 150
…
I’m not sure what to do about this since I own neither the code that does the
observing nor the class being observed. I’ll probably file a bug against Xcode,
but I’m wondering if anyone else has run into this exception?
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com
This email sent to [email protected]