Logging runtime crashes in mono on OS X - mono

I'd like to know about any and all crashes of my app 'in the wild'. We can capture managed exceptions easily enough using AppDomain.CurrentDomain.UnhandledException.
Occasionally we get crashes in unmanaged code (either through our own interactions with native libraries, or sometimes from misusing monomac or problems with monomac itself). I would like to know when these happen, as well.
I have bound the plcrashreporter framework and added it to my app. I have read the discussion around using crash reporters with Xamarin.iOS applications and implemented the workaround.
So far, so good - I can use the crash reporter and my app runs fine. However, I seem to be limited in what signals actually get caught.
For example, SIGILL and SIGABRT both get trapped by the crash reporter. A crash report is written to disk and can be read back next time the app starts up.
However, SIGSEGV and SIGBUS don't get caught. Instead, I get a stack trace written to the console along with:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
So it seems that the situation on Mac is not exactly the same as the situation on iOS. The workaround allows the crash reporter to run, but Mono doesn't seem to be raising a SIGABRT when it get a SIGSEGV from unmanaged code.
Any ideas?

The workaround for removing and reassigning the SIGSEGV and SIGBUS handlers is only required for the application to run with the debugger attached
Since we are only interested in live errors, we can surround the code to enable PLCrashReporter with an #IF DEBUG.

Related

app runs within Xcode project, but not after built

I have a Xcode project, my small mac app runs all successfully within Xcode test run after compile, but by running the debug or release build by itself, the app become unresponsive after start running. No error or warning during building.
I don't know where to look to start troubleshooting this, so totally stuck. How do you start investigating for the issue like this?
I would start by setting an exception breakpoint for your project in Xcode. Xcode will pause your app when it throws an exception. Exceptions are thrown when runtime errors occur in your code. Setting an exception breakpoint can help you find the problem in your code.
If no exception breakpoints fire when you debug the app in Xcode, you will need to update your question with more information about your app. Is your app a GUI app or a command-line app? Does your app do anything special at startup, such as load files?

EXC_BAD_ACCESS at random location iOS 9

I am facing an issue with iOS 9. My app crashes randomly with EXC_BAD_ACCESS at random location. I tried using the debugger and putting breakpoints to check for any errors.Also tried with exception breakpoints but to no help. My app runs fine on iOS 8.4 and below without any error.
I tried enabling Zombie Objects.On enabling them the App does not crashes till it is connected with the computer for debugging. As soon as the cable is disconnected the app starts crashing.
Also while debugging with Zombie Object with or without breakpoints I don't get any crashes or exception or any log on the console.
If anymore information is required please revert back .
There is a bunch of questions like this one and no general answer since the problem is that it can be caused by numerous reasons. I believe that in my case it was a bug because it has happened on random places. Luckily for me to clean a project has helped me.
So hit Shift+CMD+K and believe.

App crashes on iPod

I have created one application for iPhone. Application does a search for all watersports around the world. It is webservice based application.
My application runs smooth on Simulator without any crash report but when I create ipa file and launch same application on my iPod (I dont have my own iPhone) the application crashes after some time. Scenario of crash is not fixed so I assume this is because of Memory Leak or memory warning.
I used this function didReceiveMemoryWarning to identify memory warning but the function doesn't get called on simulator.
My Xcode version is 4.3 and unfortunately I updated the version of my iPod to iOS 6.0 so I can not test the app by connecting my iPod to the Mac. I am going to update my Mac and Xcode very soon but not soon enough to make this issue resolve/test.
Any ideas?
You can get the crash log from device using the following approaches. Check how-to-find-crash-logs or get-crash-reports-logs-from-iphone-ipad. You can symbolicate the crash log to find out the root cause. Check this question here for more details on that part Symbolicating iPhone App Crash Reports. Once you got the issue, you should be able to fix it.
Try this, put a temporary label then modify it when the didRecieveMemoryWarning is called or make an alert view that pops up when didRecieveMemoryWarning is called.
Also, run with Instruments app, its a great way to monitor your memory usage and identify memory leaks. Also try Product -> Analyze to find memory leaks from in-Xcode. Instruments is part of the SDK just search for it in spotlight.

How should one debug a SIGABRT in iOS?

The iOS simulator is issuing a SIGABRT signal attributed to main.m.
I am confused since I did not change main.m. Backtracing the debugger always returns the main function, which is not useful to me.
How does one go about debugging a SIGABRT signal in iOS? I wish XCode could let me know which line I wrote caused the signal to fire.
Here is what the console issues after terminating my program.
Couldn't register com.inimicalme.me.iosapp43 with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.
I'm not quite sure though what this means or if it is directly related to the issuing of the SIGABRT.
The error in the console usually means you need to restart your device, restart Xcode or restart your Mac. Or some combination of those.
Although, that's not usually associated with a SIGABRT, but give it a try.
The hang usually happens between two pieces - xcode and your device. If the device is a simulator, a restart will be needed. If not...
unplug your device
reset it
close xcode
reopen xcode
start again!
Good luck in the future.

iOS application crash when started

I have such problem
I am making an application with xcode 4.3.1 iOS 4.0 as target.
I have default picture as starting image.
I am using core data.
When I start application then type some info into it and then push it to background. Its all ok. If I try to start after I went to background it become crash after start image is loaded. Second launch is good without crashes. When I try to start application with some delay it does not crash.
The problem that I have no errors in debbuger and no logs about crash in iPod. All seems well.
If you had such problems, please say how you fix this issue.
P.S. Sorry for my English
You can try using logs and check out Xcode's organizer's console for your device so you can get additional info about functions that were called last.