I compiled the program below in debug mode without any error. I could run .exe file from the command line but when I try to debug code inside visual studio the exception gets thrown from the line
DetectionInternalSettings* internal_settings =
DetectionInternalSettingsFactory::createFromFileSystem(
"C:/data/card_detection_engine.yaml");
Anyone who faced this situation before where behavior is different running from command line and in debug mode.
int main(int argc, char **argv)
{
DetectionSettings settings;
try
{
DetectionInternalSettings* internal_settings =
DetectionInternalSettingsFactory::createFromFileSystem("../data/card_detection_engine.yaml");
}
catch (const MyException &e)
{
fprintf(stderr, "Exception raised: %s\n", e.what().c_str());
return 1;
}
return 0;
}
I also went into the exception details and here it is First-chance exception at 0x76E1C41F in ocrcarddetectionengine_sample.exe: Microsoft C++ exception: YAML::TypedBadConversion at memory location 0x003FF0D0.
More code related to createFromFileSystem
DetectionInternalSettingsFactory::createFromFileSystem(const std::string &configPath) throw (MyException)
{
return new DetectionInternalSettingsImpl(configPath);
}
struct DetectionInternalSettingsImpl : public DetectionInternalSettings {
DetectionInternalSettingsImpl(const std::string &config_path) {
if (config.ReadFromFilesystem(config_path)) {
throw MyException("Bad configuration path.");
}
}
~DetectionInternalSettingsImpl() { }
Core::Detector::Configuration config;
};