Exception handling when using \SUBSYSTEM:WINDOWS
- It appears that exceptions aren't caught when running in release mode with \SUBSYSTEM:WINDOWS. The application will quickly exit with no warnings at all. If I switch to debug mode and run the app, the exception is caught.
try { AfxThrowInvalidArgException(); } catch(...) { printf("it worked"); Sleep(5000); }What's going on here? How am I supposed to handle this?- Changed TypeRong-Chun ZhangMSFT, ModeratorFriday, November 13, 2009 8:02 AMOP doesn't follow up
All Replies
- You'll likely get more helpful replies if you let us know which compiler
and version you're using.
Have you tried it with a different throw? e.g. -
try {
throw 1;
}
If so, what happened?
You say you're using
\SUBSYSTEM:WINDOWS
but you are trying to use printf().
Have you attached a console to your program?
If not, where is stdout to go?
Try using a MessageBox() instead.
If using a recent version of VC++ such as 2008, check the settings under
Debug, Exceptions
and see if they are different for debug vs release builds.
- Wayne - Hello Poonaka,
I performed a test on my side, but I cannot reproduce this issue.
To narrow down the issue, please create a new project to see if the issue still happens. This can help us isolate if the issue is specific to the project. Please compare the project configuration for Debug and Release mode and see the difference. You can also paste the setting here.
Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. Hello Poonaka,
Have you got any progress on this issue? If there is anything else we can help, welcome to post here.
Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Thank you!
Rong-Chun Zhang
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


