JsonEncode crashes

the following code produces this crash for about 0.5% of the users :

guard let encodedData = try? jsonEncoder.encode(project) else {
throw AutoCapError.encodeVideoProject }

Crashed: com.apple.root.background-qos 0 libswiftCore.dylib 0x20e468 StringObject.getSharedUTF8Start() + 8 1 libswiftCore.dylib 0x20e498 StringObject.sharedUTF8.getter + 24 2 Foundation 0x259698 specialized String.withUTF8<A>(:) + 1348 3 Foundation 0x25986c JSONWriter.serializeString(:) + 100 4 Foundation 0x44648 JSONWriter.serializeJSON(:depth:) + 92 5 Foundation 0x44d68 JSONWriter.serializeObject(:depth:) + 1344 6 Foundation 0x4474c JSONWriter.serializeJSON(:depth:) + 352 7 Foundation 0x44d68 JSONWriter.serializeObject(:depth:) + 1344 8 Foundation 0x460a8 JSONWriter.serializeArray(:depth:) + 892 9 Foundation 0x44718 JSONWriter.serializeJSON(:depth:) + 300 10 Foundation 0x44d68 JSONWriter.serializeObject(:depth:) + 1344 11 Foundation 0x460a8 JSONWriter.serializeArray(:depth:) + 892 12 Foundation 0x44718 JSONWriter.serializeJSON(:depth:) + 300 13 Foundation 0x44d68 JSONWriter.serializeObject(:depth:) + 1344 14 Foundation 0x4474c JSONWriter.serializeJSON(:depth:) + 352 15 Foundation 0x43ce8 JSONEncoder.encode<A>(:value:) + 608 16 Foundation 0x43a7c JSONEncoder.encode<A>(:) + 64 17 Foundation 0x43a34 dispatch thunk of JSONEncoder.encode<A>(_:) + 56

the crash started since the iOS 17 (worked before) the project Object is has many String fields and it mostly crashes on none english languages, Why isn't the try catches the crash? what might be causing it? fool crash report is attached

There’s not much I can do with this third-party crash report [1]. Do you have an Apple crash report for this problem? If so, please post it here, using the advice from Posting a Crash Report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Some third-party crash reporters are better than others, but all of them are fundamentally unsound, for the reasons I explain in Diagnosing Issues Using Crash Reports and Device Logs.

Those three crashes are all very different, and different from the JSONWriter backtrace in your first post. That suggests you have a memory management bug, which causes a variety of unrelated subsystems to crash. I recommend that you apply the standard memory debugging tools to see if those make the problem more reproducible.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

JsonEncode crashes
 
 
Q