Code Diagnostics

RSS for tag

Enable runtime checks to detect and avoid bugs in your code using Code Diagnostics.

Code Diagnostics Documentation

Posts under Code Diagnostics tag

8 Posts
Sort by:
Post not yet marked as solved
0 Replies
63 Views
After upgrading to iOS 17, Thread Performance Checker is complaining of priority inversion when converting a CVPixelBuffer to UIImage through a CIImage instance. It might be a false-positive or an issue? - (UIImage *)imageForSampleBuffer:(CMSampleBufferRef)sampleBuffer andOrientation:(UIImageOrientation)orientation { CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pixelBuffer]; UIImage *uiImage = [UIImage imageWithCIImage:ciImage]; NSData *data = UIImageJPEGRepresentation(uiImage, 90); } The code snippet above, when running in a thread set to the default priority results in the message below: Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a lower QoS thread running at Default quality-of-service class. Investigate ways to avoid priority inversions PID: 1188, TID: 723209 Backtrace ================================================================= 3 AGXMetalG14 0x0000000235c77cc8 1FEF1F89-B467-37B0-86F8-E05BC8A2A629 + 2927816 4 AGXMetalG14 0x0000000235ccd784 1FEF1F89-B467-37B0-86F8-E05BC8A2A629 + 3278724 5 AGXMetalG14 0x0000000235ccf6a4 1FEF1F89-B467-37B0-86F8-E05BC8A2A629 + 3286692 6 MetalTools 0x000000022f758b68 E712D983-01AD-3FE5-AB66-E00ABF76CD7F + 568168 7 CoreImage 0x00000001a7c0e580 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 267648 8 CoreImage 0x00000001a7d0cc08 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 1309704 9 CoreImage 0x00000001a7c0e2e0 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 266976 10 CoreImage 0x00000001a7c0e1d0 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 266704 11 libdispatch.dylib 0x0000000105e4a7bc _dispatch_client_callout + 20 12 libdispatch.dylib 0x0000000105e5be24 _dispatch_lane_barrier_sync_invoke_and_complete + 176 13 CoreImage 0x00000001a7c0a784 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 251780 14 CoreImage 0x00000001a7c0a46c 3D2AC243-0880-3BA9-BBF3-A214454875E0 + 250988 15 libdispatch.dylib 0x0000000105e5b764 _dispatch_block_async_invoke2 + 148 16 libdispatch.dylib 0x0000000105e4a7bc _dispatch_client_callout + 20 17 libdispatch.dylib 0x0000000105e5266c _dispatch_lane_serial_drain + 832 18 libdispatch.dylib 0x0000000105e5343c _dispatch_lane_invoke + 460 19 libdispatch.dylib 0x0000000105e524a4 _dispatch_lane_serial_drain + 376 20 libdispatch.dylib 0x0000000105e5343c _dispatch_lane_invoke + 460 21 libdispatch.dylib 0x0000000105e60404 _dispatch_root_queue_drain_deferred_wlh + 328 22 libdispatch.dylib 0x0000000105e5fa38 _dispatch_workloop_worker_thread + 444 23 libsystem_pthread.dylib 0x00000001f35a4f20 _pthread_wqthread + 288 24 libsystem_pthread.dylib 0x00000001f35a4fc0 start_wqthread + 8
Posted Last updated
.
Post not yet marked as solved
2 Replies
729 Views
Our CI pipeline produces .xcresult bundles that allow developers to diagnose failures by opening them in Xcode. If the test crashes, we used to be able to open the diagnostic folders and inspect the raw test logs. As of Xcode 15, that option is no longer available. I know the Diagnostic data is there because I can view it with Xcode 14. Am I just missing something in the Xcode 15 UI? Or has the capability to browse the Diagnostics actually been removed?
Posted Last updated
.
Post marked as solved
4 Replies
251 Views
Dear all, I have the following code in a view: import SwiftUI struct RosaView: View { @State var rosa: [Rosa] = Rosa.testRosa() @State private var apriNuovoGiocatore = false @State var stagione: String = "2023/2024" var rosaFiltrata: [Rosa] { Rosa.testRosa().filter { $0.stagione == stagione } } @State private var selezioneGiocatore: Rosa.ID? = nil @State private var ordine = [KeyPathComparator(\Rosa.ruoloGiocatore)] var body: some View { VStack(alignment: .leading) { Text("Stagione: \(stagione)") .fontWeight(/*@START_MENU_TOKEN@*/.bold/*@END_MENU_TOKEN@*/) .font(.headline) .foregroundColor(/*@START_MENU_TOKEN@*/.blue/*@END_MENU_TOKEN@*/) .padding() Table(rosaFiltrata, selection: $selezioneGiocatore, sortOrder: $ordine) { TableColumn(Text("Nome").foregroundStyle(.blue), value: \.nomeGiocatore) TableColumn(Text("Cognome").foregroundStyle(.blue), value: \.cognomeGiocatore) TableColumn(Text("Ruolo").foregroundStyle(.blue), value: \.ruoloGiocatore) TableColumn(Text("Data di nascita").foregroundStyle(.blue), value: \.nascitaGiocatore) TableColumn(Text("Età").foregroundStyle(.blue)) { Rosa in Text("\(Rosa.etàGiocatore)") } } } .frame(width: 900, height: 400) .toolbar { Button { apriNuovoGiocatore = true } label: { Image(systemName: "person.badge.plus") .foregroundColor(/*@START_MENU_TOKEN@*/.blue/*@END_MENU_TOKEN@*/) } .sheet(isPresented: $apriNuovoGiocatore, content: { nuovoGiocatore() }) } .navigationTitle("Rosa") } } struct nuovoGiocatore: View { @Environment(\.dismiss) var dismiss @State var nomeNuovoGiocatore: String @State var cognomeNuovoGiocatore: String @State var nascitaNuovoGiocatore: String @State var ruoloNuovoGiocatore: String @State var etàNuovoGiocatore: Int var body: some View { NavigationStack { Form { TextField("Nome:", text: $nomeNuovoGiocatore) TextField("Cognome:", text: $cognomeNuovoGiocatore) } .navigationTitle("Nuovo giocatore") .toolbar { Button("Cancel") { dismiss() } Button("Aggiungi giocatore") { let nuovoGiocatore = Rosa(stagione: "2023/2024", nomeGiocatore: nomeNuovoGiocatore, cognomeGiocatore: cognomeNuovoGiocatore, nascitaGiocatore: nascitaNuovoGiocatore, etàGiocatore: etàNuovoGiocatore, ruoloGiocatore: ruoloNuovoGiocatore) Rosa.testRosa().append(nuovoGiocatore) dismiss() } } } } } #Preview { RosaView() } On this, I'm getting a strange error which is "Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs)" in the "var body: some View" statement of the view "nuovoGiocatore". How can I avoid it? Am I doing something wrong in the coding? Thanks, A.
Posted
by AndreB82.
Last updated
.
Post not yet marked as solved
0 Replies
344 Views
I am running xctests from command line on XCode 15.2 on iOS 17.2 simulators. As per WWDC2021 video on Memory issues, I am passing `-enablePerformanceTestsDiagnostics Yes' in following xcodebuild command. xcodebuild test -project project_name.xcodeproj -scheme test-scheme -destination 'platform=iOS Simulator,name=iPhone 15 Pro' -enablePerformanceTestsDiagnostics YES Final logs before test results: Tests-Runner(16873) MallocStackLogging: stack logs deleted from /private/tmp/stack-logs.16873.10148c000.Tests-Runner.M6gFw .xcresults is generated but no memgraph file is attached along with it.
Posted
by rcrahul4.
Last updated
.
Post marked as solved
2 Replies
518 Views
Consider the following program, memory-leak.c: #include <stdlib.h> void *p; int main() { p = malloc(7); p = 0; // The memory is leaked here. return 0; } If I compile this with clang memory-leak.c and test the output with the built-in MacOS memory leak detector leaks using leaks -quiet -atExit -- ./a.out, I get (partly) the following output: 1 leak for 16 total leaked bytes. However, if I remove the 'leaking' line like so: #include <stdlib.h> void *p; int main() { p = malloc(7); return 0; } Compiling this file and again running leaks now (partly) returns: 0 leaks for 0 total leaked bytes. The man page for leaks shows that it is only un-reachable memory that is considered a leak. Is there a configuration to detect un-free'd reachablemalloc segments?
Posted
by noicest.
Last updated
.
Post not yet marked as solved
1 Replies
549 Views
xCode requested that I send in a bug report. Failed to produce diagnostic for expression, please submit a bug report. I can't manage to paste the image here, so I'll just state that the latest Xcode, 15.1 seems to produce spurious error messages on screen which usually manage to disappear over time. I'll send this in to feedback with the sysdiagnose report. It's a major pain.
Posted
by S Wright.
Last updated
.
Post not yet marked as solved
1 Replies
594 Views
Hi folks! My iOS app has the MetricKit integration, and I'm processing the reports on my server. While looking at some MXCrashDiagnostic reports, I saw certain reports that has threadAttributed property as true, but callStackRootFrames is just an empty array. So the report looks like the following example "callStacks" : [ { "threadAttributed" : true, "callStackRootFrames" : [ ] }, // ... // other callstacks where threadAttributed is false // but callStackRootFrames is not empty ] Looking at the documentation I can see threadAttributed is used to determine if the crash/exception occurred in this crash. So I can't understand how callStackRootFrames can be empty when threadAttributed is true. Is this a bug or an expected behavior? Also, is there a case where the crash/exception report does not have any callstack with threadAttributed as true? From the definition, it feels like there should always be exactly one attributed thread on each crash report. Thanks for the help!
Posted Last updated
.
Post marked as solved
3 Replies
3.7k Views
Hello I have a problem with xCode, I have this error : Cannot find « string » in scope. Thank you so much for your help Photos: My code: // //  AuthviewModel.swift //  iSpeak // //  Created by Sayan on 21.11.22. // import Foundation import Firebase class AuthViewModel: ObservableObject {     var manager = FirebaseManager.shared          @Published var isFinishedConnecting: Bool = false     @Published var isAuth: Bool = false     @Published var showError: Bool = false          var errorString: String = ""     var datas: [String: Any] = [:]          var auth: Auth {         return manager.auth     }          init() {         observeAuthentication()     }          func observeAuthentication() {         auth.addStateDidChangeListener(handleChangeListener)     }          func handleChangeListener(auth: Auth, user: User?) {         self.isFinishedConnecting = true         self.isAuth = user != nil     }          func signIn(email: String, password: String) {         guard checkValue(_string: email, value: "adresse email") else { return }         guard checkValue(_string: password, value: "Mot de passe") else { return }              }          func createUser() {              }          func checkValue(_string: String, value: String) -> Bool {         let isNotEmpty = string != ""         self.errorString = !isNotEmpty ? "" : "Merci d'entrer (value) pour continuer"         self.showError = !isNotEmpty         return isNotEmpty     } }
Posted
by Sla1708.
Last updated
.