XCode 16 beta2 (beta1 also) hangs when trying to open complex Localizable.xcstrings

XCode 16 beta1 and beta2 hangs whenever I try to open Localizable.xcstrings. The localization screen appears but afterwards XCode becomes unresponsive until I kill it. To make matters worse, upon restart the last window, Localizaton is reloaded, instantly causing a hang again (I need to be super quick as I have about half a second to try to click elsewhere like crazy). The same localization strings file works fine on XCode 15.4.

I tried to export all localizations in 15.4, empty the file, re-generate localization strings, re-import languages one by one in 16, starting with different languages (thinking maybe a weird exotic character causes the issue with one of the languages, this happened previously crashing XCode 15 until I found the offending character and replaced it with something else). But generally even after just adding a single language there is a serious slowdown - after adding the second one, XCode hangs again.

Note: the app in question has a lot of localizable strings - I had no issue creating a simple project with only a few strings. Just hoping a fix - I really wished the issue was fixed in beta2 but now I am a bit concerned that maybe it's a rare problem and might not get fixed as I saw no similar reports so far.

Hi there! Have you had the chance to file a feedback with a sysdiagnose, after reproducing? That would help us diagnose the issues you might be seeing.

Hi there - yes, I sent the crash log using the reporter tool popping up after killing XCode + a brief explanation about what I was doing.

If it helps I can provide the offending Localizable.xcloc file along with additional details if needed.

Ok, some more info:

  • After waiting several minutes (about 5) the task seems to complete and I can navigate Localization.xcloc. However closing Localizable and opening it again starts whatever is happening again. So the hang is not permanent.
  • Simply opening Localizable.xcloc file directly outside of the project using XCode 16 seems to work without delay and not cause a hang.
  • The XCode is running at 100% CPU usage during the hang.
  • Attached a sample of what's going on with XCode a few minutes into waiting for it to finish whatever it is doing, after clicking on Localizable file in the IDE.

Hello, in addition to the crash report, could you file a Feedback report and attach the spindump above as well as the crash log if you still have it?

Also, curious where the crash comes in. Is it that it hangs for awhile and then crashes? Or was the crash at a different time?

Also, I see that in some places you mention an xcstrings file and in other places an xcloc file. Can you clarify which file is failing to load? And if you can attach that file or a similar file to the Feedback report that would be even better!

Hi there, thanks for the response.

  • To clarify, XCode only hangs - as it turns out, eventually (after about 5 minutes of intense work with 100% CPU load) it responds again and I can navigate the Localizable file. The crash log was generated only after (initially) I thought the hang is permanent and killed XCode.
  • Sorry about the inconsistency, it is an xcstrings file, mentioning xcloc was just an old habit. :)
  • I attached the xcstrings file to the Feedback report - however as I mentioned, XCode can open the xcstrings file as an individual file (when not treated as part of the project) without problem, only opening it as part of a project the hang happens.

EDIT: I sent the feedback with all the requested info (FB14108294) + added some more context/observations in the description.

Hi there, I have the same issue on Xcode Beta 1 and 2 where a file with about 400 structs will crash Xcode when building locally for a preview, or on device.

When viewing the running processes in Activity Monitor swift-frontend has about 10 or so processes each consuming 9GB+ of memory, which eventually causes a complete crash of the system.

Commenting out most of the structs (to leave about 100 or so) resolves this issue.

Happy to provide whatever I can to help resolve this.

This problem is still present in Xcode 16 beta3. :( I was hoping I could transition to the new Xcode but this prevents it.

it seems like XCode is in some kind of death spiral around IDEXclocNavigableFileRep.respondToXclocChange(_:) and IDEXclocNavigableRep.respondToXclocChange(_:), but I see many more mentions of localization related stuff.

I really hope this will be fixed. I had a fair share of issues with Localizations in Xcode 15 as well but those at least had workarounds (mostly various crashes on commit or push because of certain offending characters which I had to hunt down manually, sometimes spending hours to figure out what offendeds Xcode), but this is an issue I can't seem to find the workaround for.

Things improved vastly in beta4. There is still a hang when opening Localizable but it only takes 6-7 seconds (MBP 16" M3 Max), which is much better than the minutes it took previously. The same delay happens on completion of a build. CPU usage is 100% and even the Bezel notification ("Build succeeded") on build completion stays locked on-screen for this period of time (as previously, but for a much shorter time).

An other huge improvement is that the delay does not happen every time I open Localizable or rebuild the project - whatever is happening, the results are now remembered for a while, which is great.

With this XCode 16 is now usable for me, so I am happy. Thank you!

Note: I think whatever XCode is doing with the strings during these times, it still should be doing it asynchronously and give a feedback to the user it's working on something instead of making the UI fully unresponsive.

Sadly localization still causes a 5-15 seconds complete freeze (with the Build Succeeded bezel notification stuck on the center of the screen) after a compile when changing any SwiftUI source - even in the latest beta6. I guess this won't be fixed now, but this is something truly disrupting and slows things down especially if one needs to recompile a lot.

Somewhat unrelated, but Xcode still tends to crash on commits due to some character issue somewhere in localization. With the huge, monolithic Localizable.xcstrings it is almost impossible to figure out what character and where offends XCode and whenever translators change something and a new translation is imported, the issue reemerges anyway, so we gave up hunting for these issues and instead switched to using GitHub Desktop to commit and push as Xcode is basically useless for this task.

While all the improvements are truly appreciated, things are very half-baked still, it would be great if Localization support could be improved, it's now a huge pain. :|

I'm sorry that current performance hasn't been where it needs to be. Please continue to file Feedback reports for any stability or performance problems you see.

The sample data you provided in FB14108294 was very helpful in tracking down and fixing the multi-minute hang and we welcome additional reports to help us continue improving Xcode's performance and stability.

Thank you!

I posted two additional feebacks:

  • FB14906558 about the crash on commit with crash log included. Issue happens with probably some offending character somewhere in the huge Localizable.xcstrings file which Xcode might have issue processing changes to show diff on the Commit tab. Crash consistently happens at SourceEditorDataSource.contentRangeForLineRange(_:) + 244

  • FB14906651 is about the hang/wait on end of most builds or sometimes opening Localizable.xcstrings. During this the CPU is at 100% and Xcode is indicated as not responding by Activity Monitor. Most of the activity causing the hang seems to be happening in IDEXclocNavigableRep.respondToXclocChange(_:) (in IDELocalizationCatalogEditor) + 256. This however usually takes only 5-15 seconds, so much better than the initial issue. Still, this wait adds up, especially if one needs to build regularly.

Thank you for looking into these issues, I really appreciate your work and sorry for the grumpy tone of my earlier comment. :]

Thank you for filing these!

Still, even with the latest 16.1 beta2 I experience some of these issues.

  • The long delays on compile is mostly gone, which is a welcome improvement! :)
  • Opening Localizatble.xcstrings still cause some temporary hang.
  • Any commit that involves Localizable.xcstrings however still crashes XCode at SourceEditorDataSource.contentRangeForLineRange(_:) + 244 (issue described in FB14906558):
Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   SourceEditor                  	       0x1172202e4 SourceEditorDataSource.contentRangeForLineRange(_:) + 244
1   IDEDelta                      	       0x372d9d768 specialized Collection.map<A, B>(_:) + 212
2   IDEDelta                      	       0x372d9a198 SourceCodeGalleryExhibitEditor.delta_collapseToSuggestedLineRanges(for:) + 796
3   IDEDelta                      	       0x372d64e7c ComparisonContext.sessionDidScrapeDiffResults(_:) + 276
4   IDEDelta                      	       0x372d651f8 @objc ComparisonContext.sessionDidScrapeDiffResults(_:) + 52
5   DeltaFoundation               	       0x1313dd4e8 -[DESession _notifySessionDidScrape] + 212
6   DeltaFoundation               	       0x1313dcf3c -[DESession _scrapeResults] + 400
7   DeltaFoundation               	       0x1313dc940 __38-[DESession performDiffAsynchronously]_block_invoke_3 + 68
8   libdispatch.dylib             	       0x184dc68f8 _dispatch_call_block_and_release + 32
9   libdispatch.dylib             	       0x184dc8658 _dispatch_client_callout + 20
10  libdispatch.dylib             	       0x184dd6f68 _dispatch_main_queue_drain + 980
11  libdispatch.dylib             	       0x184dd6b84 _dispatch_main_queue_callback_4CF + 44
12  CoreFoundation                	       0x1850a0bb4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
13  CoreFoundation                	       0x185060930 __CFRunLoopRun + 1996
14  CoreFoundation                	       0x18505fae8 CFRunLoopRunSpecific + 572
15  HIToolbox                     	       0x1905e9f64 RunCurrentEventLoopInMode + 292
16  HIToolbox                     	       0x1905efd54 ReceiveNextEventCommon + 636
17  HIToolbox                     	       0x1905efeb8 _BlockUntilNextEventMatchingListInModeWithFilter + 76
18  AppKit                        	       0x188ba0e2c _DPSNextEvent + 660
19  AppKit                        	       0x1894dae2c -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
20  AppKit                        	       0x188b93e80 -[NSApplication run] + 480
21  IDEKit                        	       0x107d60ee0 -[IDEApplication run] + 60
22  AppKit                        	       0x188b6a750 NSApplicationMain + 888
23  dyld                          	       0x184bf8274 start + 2840
XCode 16 beta2 (beta1 also) hangs when trying to open complex Localizable.xcstrings
 
 
Q