macOS 13 Under The Hood - The Merger

macOS 13 Under The Hood - The Merger

For many years, Apple has developed and distributed multiple different operating systems, for Mac, iPhones, iPads, Watch, and more.

All of these always had a similar core that was evolved from the initial Mac operating system versions.

In the long run, maintaining multiple similar, but yet different code bases is a lot of work, and makes it a lot harder to fix bugs.

So from a development standpoint, it was always clear that one day, Apple would merge the code.

And they actually started doing that in macOS 13, as we have found more or less by accident.

How do we know?

The many new bugs introduced in the recent betas of macOS 13 "Ventura" have shown some very interesting details of what Apple is doing deep under the hood, and what implications these modifications can have for developers and users.

While we are working our way around the bugs that Apple has introduced in macOS 13, to make our flagship software NeoFinder ready and compatible with "Ventura," we have seen a very unusual crash, and an even more interesting crash log (or
stack trace).

[General] The window has been marked as needing another Display Window pass, but it has already had more Display Window passes than there are views in the window.
(
0 CoreFoundation 0x00000001b38315bc __exceptionPreprocess + 176
1 libobjc.A.dylib 0x00000001b340b0c8 objc_exception_throw + 60
2 CoreFoundation 0x00000001b3831460 +[NSException exceptionWithName:reason:userInfo:] + 0
3 AppKit 0x00000001b69f20b4 -[NSWindow(NSDisplayCycle) _postWindowNeedsDisplayUnlessPostingDisabled] + 1832
4 AppKit 0x00000001b69f9044 -[NSView _setSuperview:] + 800
5 AppKit 0x00000001b69f8b64 -[NSView addSubview:] + 124
6 UIFoundation 0x00000001b79ab168 __48-[NSTextViewportLayoutController layoutViewport]_block_invoke_2 + 152
7 UIFoundation 0x00000001b792a334 __80-[NSTextLayoutManager enumerateViewportElementsFromLocation:options:usingBlock:]_block_invoke + 44
8 UIFoundation 0x00000001b7924fe8 __83-[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:]_block_invoke_2 + 544
9 CoreFoundation 0x00000001b37aa644 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24
10 CoreFoundation 0x00000001b37bfcbc -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 92
11
UIFoundation 0x00000001b7924cbc __83-[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:]_block_invoke + 780
12 UIFoundation 0x00000001b792e3fc -[NSTextContentStorage enumerateTextElementsFromLocation:options:usingBlock:] + 3900
13 UIFoundation 0x00000001b79248b4 -[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:] + 576
14 UIFoundation 0x00000001b792a2fc -[NSTextLayoutManager enumerateViewportElementsFromLocation:options:usingBlock:] + 100
15 UIFoundation 0x00000001b79aac54 -[NSTextViewportLayoutController layoutViewport] + 1304
16 AppKit 0x00000001b6b253ec -[NSTextView layout] + 328
17 AppKit 0x00000001b6a265a0 _NSViewLayout + 576
29 AppKit 0x00000001b6a261f0 -[NSView _layoutSubtreeWithOldSize:] + 664
30 AppKit 0x00000001b6a256f0 -[NSView _layoutSubtreeIfNeededAndAllowTemporaryEngine:] + 800
31 AppKit 0x00000001b73e5984 -[NSWindow(NSConstraintBasedLayoutInternal) _layoutViewTree] + 104
32 AppKit 0x00000001b73e5b0c -[NSWindow(NSConstraintBasedLayoutInternal) layoutIfNeeded] + 240
33 AppKit 0x00000001b6a859d8 __NSWindowGetDisplayCycleObserverForLayout_block_invoke + 364
34 AppKit 0x00000001b6a84f74 NSDisplayCycleObserverInvoke + 168
35 AppKit 0x00000001b6a84bd0 NSDisplayCycleFlush + 644
36 QuartzCore 0x00000001bad7c35c _ZN2CA11Transaction19run_commit_handlersE18CATransactionPhase + 120
37 QuartzCore 0x00000001bad7b0dc _ZN2CA11Transaction6commitEv + 324
38 AppKit 0x00000001b6b07ab0 __62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke + 272
39 AppKit 0x00000001b71da838 ___NSRunLoopObserverCreateWithHandler_block_invoke + 64
40 CoreFoundation 0x00000001b37b622c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
41 CoreFoundation 0x00000001b37b6118 __CFRunLoopDoObservers + 532
42 CoreFoundation 0x00000001b37b5750 __CFRunLoopRun + 784
43 CoreFoundation 0x00000001b37b4cec CFRunLoopRunSpecific + 612
44 HIToolbox 0x00000001bce5fa68 RunCurrentEventLoopInMode + 292
45 HIToolbox 0x00000001bce5f8ac ReceiveNextEventCommon + 672
46 HIToolbox 0x00000001bce5f5f4 _BlockUntilNextEventMatchingListInModeWithFilter + 72
47 AppKit 0x00000001b69dd0f8 _DPSNextEvent + 632
48 AppKit 0x00000001b69dc288 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
49 AppKit 0x00000001b69d0608 -[NSApplication run] + 464
50 AppKit 0x00000001b69a78ec NSApplicationMain + 880
51 NeoFinder 0x0000000102a8b024 main + 36
52 dyld 0x00000002397a4da8 start + 2376


This log contains references of a very peculiar Apple macOS System framework, called
UIFoundation.

This discovery indicates that deep under the hood of the established and proven AppKit and CoreFoundation macOS frameworks, Apple is merging the different operating systems already.

UIFoundation is actually the basic core iOS framework. It has been part of the "PrivateFrameworks" folder since macOS 11, when it was introduced to run iOS application in macOS on M1 and M2 Macs.

Needless to say, we have never before seen that particular Framework in any crash reports or stack traces of our Mac-based software, so this is new to macOS 13.

This shows that Apple has started merging macOS and iOS foundations from two separate code bases into a single one.

Is a merger so bad?

Not in the long run, because it actually reduces the amount of source code that Apple has to maintain and fix.

But the release of macOS 13 will be very rocky.

Two reasons for that.

First, Apple never told us developers about it, and as replacing the basic foundation of macOS with new code means that effectively ALL system calls that every applications makes must be carefully checked for new bugs and changed behaviour. Code that was known to be working and stable all of a sudden can cause problems and serious bugs, as the operating system has been changed. So we must test our applications a lot more than usual, and essentially check every single function, even those we did not change on our side. But as Apple did NOT communicate this massive change, a lot of developers will be as surprised by this as we were.

Second, replacing the entire core of an operating system will always cause new bugs and problems. After 20 years of Mac OS X, essentially we have to assume that the entire base of macOS is new, untested, and unproven.

Unfortunately, Apple also has been really slow in fixing bugs lately.

So instead of the mostly stable base macOS layers required for insanely great software products that we had for many years, we get brand new and buggy frameworks from Apple, and these clearly still need to prove how good they are.

Stay tuned for trouble with your beloved and known applications in macOS 13.

So far NONE of the many bugs accumulated in recent major macOS releases that we have reported have been fixed by Apple in macOS 13 "Ventura". A shame, really.