How do I debug XPC Services in XCode 4? - xcode4

I added an XPC Service to my project and I would like to set breakpoints and inspect variable contents in the debug area in XCode. Breakpoints that I set in the service's code are not recognized (obviously, the debugger is attached to the main apps process. How and I attach the debugger (manually or automatically) to the XPC Service process after my main app launches it? Is there some way to run the service alone and send it messages without it being launched from the main app?

Debug -> Attach To Process -> By Process Identifier (PID) or Name...
Type in your XPC service process name. The next time launchd starts up your XPC service, Xcode will attach.

I am actually not sure how to attach the debugger. But you can still use "NSLog" for debug output on the console. Then start the "Console.app" in "/Applications/Utilities/Concole.app". Depending on your system language this app may have a different name (it's localized). It shows ALL NSLog outputs from all Applications which are running including your xpc-services.
It's not the debugger, but you will get informations out of your service.

Related

.net core console application on PCF

I'm able to deploy a .net core console app on PCF which raises some internal events and runs for sometime(with help of Thread.Delay()) and exits. I want to be able to start and stop this app remotely, using a batch file from windows machine.
When I push this app to PCF I have explicitly put --no-start flag in the push command. The app gets deployed and doesn't starts and I can start this remotely with cf start command. Once it exits successfully PCF tries to restart it considering it as crashed so in order to restart i would first need to cf stop and then use start command.
I need help in understanding - if there is any other better way to do this. Originally we were planning to use Tasks on PCF; but as per my understanding Tasks are command which runs on other application(please correct me if I am wrong)
Any thoughts will help.
Thanks in advance.
I modified my app logic to achieve this. I did the following -
Deployed app with --no-start flag
In the app entry method I checking the value of arg passed from command line
if arg==required_key then run the job else return
I do a cf start which builds, stages the app and the app gets started but no results displayed on console
cf stop
cf run-task APP_NAME "dotnet appname.dll required_key"
The above task runs one time and destroys itself.

watchkit extension 2 iOS app crash at start in simulator

I have configured the WatchKit App to run in my project (WatchOS2).
When I try to run it into the simulator the WatchKit App start perfectly, but each times I'm trying to start the iOS app, this one crash.
The simulator's log show me that :
com.apple.CoreSimulator.SimDevice.5F243C10-E98D-4A20-8950-2742FE6CABD5.launchd_sim[13288] (UIKitApplication:com.MyCompany.MyProject[0x847][13496]): Service exited due to signal: Trace/BPT trap: 5
All of my code in the application delegate is in comment. just enough to start
If I build and use my main app target with the same simulator setting, that works nicely. it just when I build and run the watchkit extension target.
I tried to clean everything (derived data, simulator setting and contents).
I know, it is not the simulator, because with a new project, the issue is not here. it might be something set somewhere ??
but nothing works, any idea ?.
Your application aborted, likely due to a failed assertion. You should look at the crash log (in ~/Library/Logs/DiagnosticReports) for more details.

Launch Client Console App from Web Page

I've been asked to launch a Console App from a WebPage. Sounds hairy, but there is sound logic for it.
Basically, the page is a Dashboard page which only super admins can access. We have a Console app which needs to run on the client machine. It cannot run headlessly on the server.
I figured I'd have some kind of small file which is downloaded upon the button click. Then that file could be run from the resulting dialog which would launch the exe.
I know apple does something like that with podcasts. You can subscribe by downloading a small link that would behave as I described and open iTunes.
I had a quick go using ClickOnce, publishing the application to IISExpress where I had my site up and running, but had no success with that.
Is ClickOnce the way to go, or is there some other easier approach?
I've also tried just adding a shortcut with a link to that shortcut nd adding .lnk as a mime type in IIS with mimeType="application/octet-stream". I had no luck there and received a 404 error which I have not been able to resolve yet.
Edit
I should also mention that the Console application is not just a single exe assembly. It has dependencies on a bunch of other 3rd party dlls.
I am assuming here that this desktop application needs to be executed at client side. Thus it will be installed by you or someone in your department i.e available to download.
If it is the case then what you need is to register URI - just like skype URI where href="skype:28347839" lanuches skype automatically.
For reference please click here: http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx
otherwise, get clickonce - -choice is yours.
As you say, just put the console application (an .exe file) on the server, and link to it in a webpage. When the user clicks on the link the exe file will be downloaded. The user can then run the exe file on their own computer.
There will be some warning dialogs about security issues, but if your users trust your exe then they can accept those warnings.
If you get the console application signed, and/or maybe use Group Policy on your LAN you might be able to reduce or eliminate those warnings.

c# windows app OK in debug mode, faulty in release mode

I've written a c# windows app, that performs some DB intensive operations. (MySQL connector v6).
When running the project in Debug mode, everything works fine. However, when I run the prject in release mode, it sometimes quits operation midway - with no error message, nothing in the event logs etc.
What would be the best way to debug release mode - when everything works in debug mode?
Thanks for any help,
Bob
You can create a log file and have the application write lines to it with information of your choice, similarly to how the console may be used for debug purposes in a windows form application. You can write values of certain variables to this file, or even just write distinct phrases in select places of the code that will help you detect where the program is in execution when it fails.
Bobby is correct in asking about Application Event Log. If it is bombing on a .NET error, it will likely be logged.
If that doesn't give you anything, wrap the entire app in a try/catch block. On your exception handling, log the error (application log, file, etc...). Make sure when you log it to capture the call stack.
I've got exactly the same problem - application running in debug mode and fail in release. Try the following:
Wrap everything in Program.cs in try{}..catch{} block and it will show a reason
I don't know why but my application failed on Program.SetCompatibleTextRenderingDefault() function with message that it should be called before any instances on IWin32Window or something like that
It is very strange errors for me cuz i didn't have any code before this function. But you can try - maybe it will show something useful for you

EQATEC Profiler - The remote server returned an error: (404) Not Found

I'm trying to use EQATEC Profiler to profile my ASP.Net app. I followed the instructions listed here. It worked the first time, but every since then, when I run my app, I don't get a "Profiled app started" message. Then when I click on the "Take snapshot" button, I get the following:
"Taking snapshot ...failed: The remote server returned an error: (404) Not Found."
Why can't it find my app?
If a profiled app encounters errors it will log these to the profiler.log file. By default you will find this in C:\Windows\Temp\EQATECProfilerLogs. Try to see if it holds some clues. You can also try to enable "Full logging" in the app options, which will at least output something to the log.
A profiled app is actually the "server" when talking to the profiler; it is the profiler that connects to the app, not the other way around. In your case it seems that the old app has stopped listening (otherwise the profiler's attempt to connect would simply be served by the old app), but the new app has not (could not?) started listening.
It seems strange, though, so my best suggestion is to examine the log-file. It will e.g. show if the app could not start its control-server and if so, why not.
1) Try rebuilding (in Equatec) your application. Make sure "enable runtime control" is enabled in the application options when you build.
1a) Try changing the port being used for runtime control.
2) Run your application through Equatec
3) Check if you have anything funny for firewall settings or similar. Some firewalls treat Equatec communication as traffic to be blocked.
4. If all else fails, just close your application normally. Even if taking snapshots fails, you can still see the profile once your application is closed.
Guess I should provide an update on this. The error was resolved once I downloaded the latest version.

Resources