Re: try-catch not working on customer windows platform.
On 8/12/2014 9:56 PM, Hongliang Wang wrote:
Dear all,
I have a try-catch block in my code. When error occurs I could see it is working properly on my development machine. But on customer machine there is simply a Windows warning message saying 'EXE has stopped working'.
CODE is follows:
try {
if(posMake == exifData.end()) {
throw DTException(0x100108, ERR_100108_MAKE,
imageFile->getPath());
}
}
catch(DTException &e) {
DTRunTimeError(e);
}
DEVELOPMENT PLATFORM: Windows 8 64bit
MSVC: 2012
CUSTOMER PLATFORM: WINDOWS 7 64bit
NO MSVC installed.
I could think of two possible reasons:
1. Compiler flag is -EHsc. Maybe -EHa would be working?
2. System DLLs are deployed onto target machine is not enough? I am deploying MSVC file: msvcp110.dll and msvcr110.dll from MSVC redistribution directory.
Could anybody give me a hand please, thanks in advance.
I doubt the problem is the try-catch itself. Like was said, it is most
likely code executing before or during that does something illegal. It
really could be anything anywhere. You left information out as to what
drew your attention to the try catch in the first place?
(OT - Windows Debugging specific)
In this scenario, short of remote debugging like Paavo suggested, I'd
try setting the executable in question to create a crash dump, then
debug the crash dump. Be aware that like remote debugging, you will need
matching symbols. You can do this in release as well as debug builds,
the difference being the ability to step through optimized code. Do
debug if the customer permits the scenario, if not do release with
symbols and any optimizations you can turned off.
A good google search should yield some MSDN articles on how to debug
using crash dumps if needed.