Click here to Skip to main content
13,254,187 members (49,091 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I'm programming a project that sent a file from computer to phone.
I use BluetoothCLTools- programs to discovery and send my files.
There is my code:
Process p = new Process();
                ProcessStartInfo psi = new ProcessStartInfo("cmd","/c"+@"btobex -n"MyPhone" "C:\A.txt"");
                p.StartInfo = psi;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardError = false;
                p.StartInfo.ErrorDialog = false;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.UseShellExecute = false;

There is no problem when i use Command prom directly, but when start command prom by my code and sending file to phone if i select NO when my phone ask permission to receive file, the program has a error like this:
Problem Event Name=APPCRASH

there is no error when i use
Posted 5-Oct-12 5:13am
Updated 5-Oct-12 5:15am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I'm not sure about why you would get the APPCRASH and such, but my thought is that anytime you need to instantiate a process like this it would be wise for you to wrap the entire block in a try catch so that when anything unforseen happens in that 3rd party application you can at least deal with it gracefully in your code. I'm not assuming you haven't done this, but I thought it worthwhile to mention just in case.
If you use the try catch you can check for the APPCRASH state and "assume" that the user has selected no. Hopefully for you there aren't more situations that will cause this particular error to occur.
ghoomes 5-Oct-12 10:30am
thank you for your answer..
error isn't in my code, I use try and catch, problem is from "btobex.exe" that i call it. there is no problem when i call it in CMD directly but when i call it in program the APPCRASH will Appear
Marcus Kramer 5-Oct-12 10:39am
That is exactly why you need to handle that situation gracefully in your application. It's just one of those things that is necessary when dealing with 3rd party applications. I'm guessing that the APPCRASH is still occurring under the hood when you call the application directly, but the message doesn't get back to you using that method. You're likely only aware of it when attached to the process.
ghoomes 5-Oct-12 10:47am
yes, you're right.. can i use some code to control APPCRASH error that doesn't show to user?!
Marcus Kramer 5-Oct-12 11:30am
If the message pops up in a message box from the 3rd party app then I'm pretty sure there's nothing you're going to be able to do, but if your try-catch captures the error then you may be able to gobble the message.
ghoomes 5-Oct-12 11:51am
oooh.. thanks.. :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100