Question:
How do you skip a .NET framework unhandled exception error?
Jason
2013-11-06 03:32:43 UTC
I created a C# program in SharpDevelop that needs to update a text file. The program works fine when i run it from SharpDevelop. But when i try to run it from outside Sharpdevelop with the .exe application file, I keep on getting the following error message:

"Unhandled exception has occured in your application. If you click Continue, the application will ignore this error abd attempt to continue.If you click Quit, the application will close immediately.

The process cannot access the file 'C:\path' because it is being used by another process."

When i click Continue the program runs as normal and there seems nothing wrong. What can i do to skip this error message and go staright to opening the application?
Three answers:
2013-11-06 05:08:07 UTC
by uninstalling asp.net

and by using http://php.net in ubuntu LINUX



http://www.ubuntu.com/download/desktop



install php by typing command



sudo apt-get install apache2

sudo apt-get install php











lol
Jonathan
2013-11-06 20:50:42 UTC
I didn't even know SharpDevelop existed until today. Never tried to use it, obviously. But I can suggest some ideas about the problems.



The unhandled exception may be because you compiled in Debug mode and/or because SharpDevelop added some interrupt code that the IDE handles for your application. It "feels" like that to me. Sometimes, an IDE stuffs "hooks" into the code generation which generate an interrupt that the IDE informs Windows it will handle. That way, the application feeds information back to the IDE. If the IDE isn't present, Windows has NO IDEA what to do. So instead it generates an error very much like what you reported. So this really may NOT be a .NET question, but more a SharpDevelop question. And there, I can't help at all.



To work towards solving the other problem, I'd try to first reboot the computer. This ALWAYS clears the "being used by another process" problem, unless there is a server process that attaches the file at reboot. Don't use your program to re-attempt the access, at first. Just try and rename the file after rebooting. If that works, then it's not being locked. Then rename it back and try your program. However, I fear you will have that problem with the unhandled exception. And then, perhaps, the 2nd time you try running your program you may get that "used by another process" problem, as Windows was confused by the prior run and is now just going to be a pain about it.



So I'd really focus on the first problem and get that resolved..



Clicking on continue just tells Windows to ignore the wayward exception and return to the code after it. Lots of times that allows the code to work. If it is an IDE hook, there is no reason your code won't work afterwards (unless it tries to hook the IDE again, of course.)
2013-11-06 11:52:26 UTC
use exception handling.write the code in try catch block and save the file path in same directory


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...