I have implemented a Timeout functionality in my system so that user query would just terminate at a user given timeout. I am using cmd.CommandTimeout to achieve that. When I run the procedure through application, I get a windows alert saying "Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately." If I click continue, the application procedure which called the sql stored procedure gets stuck infinitely. After that when I reopen the application, it says throws another exception "Object is currently in use".
However, when I open the application using VS while debugging instead of .exe file, it handles the exception normally as expected in code and no such alert window comes.
I suppose it can be due to a deadlock situation somewhere but I'm not sure. Note: I am using nolock in the procedure, just to be clear.
User contributions licensed under CC BY-SA 3.0