You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can follow the instructions for setting up the Bugsnag SDK, but when running inside a Swift command-line app the crashes never make it to Bugsnag. The crash report gets written out, but it doesn't show up in the web UI.
Build logs
Steps to reproduce
Type swift run
See that no events show up in the Bugsnag Web UI
Environment
Bugsnag version: 6.6.1
iOS/tvOS/macOS version(s): Ventura 13.2
Xcode version: 14.2
Swift version (if applicable): 5.7
Example code snippet
Setup
Sources/Porter.swift
import Foundation
import Bugsnag
@mainpublicstructPorter{publicstaticfunc main(){log("Hello, \u{1F30E}!")
// API key for Bugsnag Swift tooling
Bugsnag.start(withApiKey:"9be<redacted>")Bugsnag.notifyError(NSError(domain:"com.porter.mac.test_error", code:422, userInfo:nil))print("Done")}}
Package.swift
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
letpackage=Package(
name:"Porter",
dependencies:[
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url:"https://github.com/SwiftyJSON/SwiftyJSON.git",.upToNextMajor(from:"4.0.0")),.package(url:"https://github.com/bugsnag/bugsnag-cocoa",.upToNextMajor(from:"6.0.0")),],
targets:[
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.executableTarget(
name:"Porter",
dependencies:["SwiftyJSON",.product(name:"Bugsnag",package:"bugsnag-cocoa")],
path:"Sources"),.testTarget(
name:"PorterTests",
dependencies:["Porter"],
path:"Tests"),])
Log output when running from Xcode
[0;34mHello, 🌎!�[0;0m
2023-02-15 09:03:56.108605-0800 Porter[94166:13134073] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=94166
2023-02-15 09:03:56.108798-0800 Porter[94166:13134073] SecTaskCopyDebugDescription: Porter[94166]/0#-1 LF=0
2023-02-15 09:03:56.129630-0800 Porter[94166:13134073] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=94166
2023-02-15 09:03:56.129747-0800 Porter[94166:13134073] SecTaskCopyDebugDescription: Porter[94166]/0#-1 LF=0
WARN : BSG_KSCrashSentry.c (104): BSG_KSCrashType bsg_kscrashsentry_installWithContext(BSG_KSCrash_SentryContext *, BSG_KSCrashType, void (*)(void *)): App is running in a debugger. Only handled events will be sent to Bugsnag.
WARN : BSG_KSCrashSentry.c (104): BSG_KSCrashType bsg_kscrashsentry_installWithContext(BSG_KSCrash_SentryContext *, BSG_KSCrashType, void (*)(void *)): App is running in a debugger. Only handled events will be sent to Bugsnag.
ERROR: BSG_KSMach.c (201): _Bool bsg_ksmachfillState(const thread_t, const thread_state_t, const thread_state_flavor_t, const mach_msg_type_number_t): thread_get_state: (ipc/send) invalid destination port
ERROR: BSG_KSCrashReport.c (397): struct __darwin_mcontext64 *bsg_kscrw_i_getMachineContext(const BSG_KSCrash_SentryContext *const, const thread_t, struct __darwin_mcontext64 *const): Failed to fetch machine state for thread 2819
ERROR: BSG_KSMach.c (201): _Bool bsg_ksmachfillState(const thread_t, const thread_state_t, const thread_state_flavor_t, const mach_msg_type_number_t): thread_get_state: (ipc/send) invalid destination port
ERROR: BSG_KSCrashReport.c (397): struct __darwin_mcontext64 *bsg_kscrw_i_getMachineContext(const BSG_KSCrash_SentryContext *const, const thread_t, struct __darwin_mcontext64 *const): Failed to fetch machine state for thread 3331
ERROR: BSG_KSMach.c (201): _Bool bsg_ksmachfillState(const thread_t, const thread_state_t, const thread_state_flavor_t, const mach_msg_type_number_t): thread_get_state: (os/kern) invalid argument
ERROR: BSG_KSCrashReport.c (397): struct __darwin_mcontext64 *bsg_kscrw_i_getMachineContext(const BSG_KSCrash_SentryContext *const, const thread_t, struct __darwin_mcontext64 *const): Failed to fetch machine state for thread 28679
INFO : BSG_KSCrashReport.c (1564): void bsg_kscrashreport_writeStandardReport(BSG_KSCrash_Context *const, const char *const): Writing crash report to /Users/stevenhepting/Library/Application Support/com.bugsnag.Bugsnag/(null)/v1/KSCrashReports/(null)-CrashReport-D975108A-68D3-4CA7-83CF-14548C4727DF.json
Done
Program ended with exit code: 0
Log output when running from the command-line with SPM (`swift run`)
╰─ swift run
Building for debugging...
[3/3] Linking Porter
Build complete! (0.75s)
Hello, 🌎!
INFO : BSG_KSCrashReport.c (1564): void bsg_kscrashreport_writeStandardReport(BSG_KSCrash_Context *const, const char *const): Writing crash report to /Users/stevenhepting/Library/Application Support/com.bugsnag.Bugsnag/(null)/v1/KSCrashReports/(null)-CrashReport-0D3B2D79-DC4D-4B91-B184-3702289E71A9.json
Done
The text was updated successfully, but these errors were encountered:
The interesting thing, is that I can add this same key to a new test app that runs in the iOS Simulator and it works fine. My two test events uploaded without error:
Hi @shepting - bugsnag-cocoa doesn't currently support native Swift apps, including Swift CLI apps. We have an item on our product roadmap to support this in the future, however I don't have an ETA for that at this stage. We'll make sure that we keep this thread updated 👍
Describe the bug
I can follow the instructions for setting up the Bugsnag SDK, but when running inside a Swift command-line app the crashes never make it to Bugsnag. The crash report gets written out, but it doesn't show up in the web UI.
Build logs
Steps to reproduce
swift run
Environment
Example code snippet
Setup
Sources/Porter.swift
Package.swift
Log output when running from Xcode
Log output when running from the command-line with SPM (`swift run`)
The text was updated successfully, but these errors were encountered: