Hi,
I am getting a crash report from a user, where they get an application crash when they open a CSV file on their device. I use the standard DataFrame(contentsOfCSVFile: fileURL, options: options)
initializer to create a DataFrame, but that's where it's crashing, even though it's inside a try-catch block:
public func loadInitialCSVData(withURL fileURL: URL) throws -> DataFrame {
let options = CSVReadingOptions(hasHeaderRow: true, delimiter: ",")
do {
let dataFrame = try DataFrame(contentsOfCSVFile: fileURL, options: options)
} catch {
// log error here - doesn't get here
}
This is from the crash report:
Exception Type: SIGTRAP
Exception Codes: TRAP_BRKPT at 0x21e02be38
Crashed Thread: 0
Thread 0 Crashed:
0 TabularData 0x000000021e02be38 __swift_project_boxed_opaque_existential_1 + 9488
1 TabularData 0x000000021e099d64 __swift_memcpy17_8 + 4612
2 TabularData 0x000000021e099958 __swift_memcpy17_8 + 3576
3 TabularData 0x000000021e09935c __swift_memcpy17_8 + 2044
4 Contacts Journal CRM 0x000000010433f614 Contacts_Journal_CRM.CJCSVHeaderMapper.loadInitialCSVData(withURL: Foundation.URL) throws -> TabularData.DataFrame (CJCSVHeaderMapper.swift:26)
5 Contacts Journal CRM 0x00000001043009d8 (extension in Contacts_Journal_CRM):__C.MacContactsViewController.handleSelectedCSVFileForURL(selectedURL: Foundation.URL) -> () (MacContactsViewControllerExtension.swift:28)
6 Contacts Journal CRM 0x0000000104301e64 @objc (extension in Contacts_Journal_CRM):__C.MacContactsViewController.handleSelectedCSVFileForURL(selectedURL: Foundation.URL) -> () (<compiler-generated>:0)
7 Contacts Journal CRM 0x0000000104222c94 __51-[MacContactsViewController importCSVFileSelected:]_block_invoke (MacContactsViewController.m:954)
8 AppKit 0x00000001bbe8f294 -[NSSavePanel didEndPanelWithReturnCode:] + 84`
I can't diagnose the crash, because it doesn't have more information. I don't have access to the CSV file currently either, so I don't know what else I can do to prevent it.
What could possibly be causing this crash? Does it not matter that I am also trying to catch the errors it's throwing, or can the app crash because of some internal reasons with the framework?
Yes, I was able to replicate the issue with a CSV file with duplicate column names
Please try this out on the macOS 13 beta that we just seeded. My understanding is that this problem is fixed there.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"