parse_exception thrown inside astra_initialize

I just found out that SDK initialization throws a C++ exception internally, which is caught by my Visual Studio debugger.

My environment is:
Windows 7 64-bit
Visual Studio 2015 Community Edition
32-bit C++ application, Debug configuration
Running with debugger (using F5 key)

Program execution breaks with message:

Exception thrown at 0x7578C42D in MyApp.exe: Microsoft C++ exception: cpptoml::parse_exception at memory location 0x0028D4D0.

If there is a handler for this exception, the program may be safely continued.


KernelBase.dll!7578c42d() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]
orbbec_hand.dll!01ecd53f() Unknown
orbbec_hand.dll!01ecf220() Unknown
[External Code]
Astra.dll!el::base::Writer::initializeLogger(const std::basic_string<char,std::char_traits,std::allocator > & loggerId, bool lookup, bool needLock) Line 4995 C++
[External Code]
orbbec_hand.dll!01edb3ab() Unknown
orbbec_hand.dll!01eb857c() Unknown
Astra.dll!astra::plugin_manager::try_load_plugin(const std::basic_string<char,std::char_traits,std::allocator > & path) Line 97 C++
Astra.dll!astra::plugin_manager::load_plugins(std::basic_string<char,std::char_traits,std::allocator > searchPath) Line 23 C++
Astra.dll!astra::context_impl::initialize() Line 55 C++
Astra.dll!astra_initialize() Line 24 C++
MyApp.exe!astra::Astra::initialize() Line 19 C++
(My code…)

It doesn’t matter if the camera is actually connected to my PC or not. It doesn’t matter if files “astra.log”, “profile_openni_sensor.txt”, “profile_orbbec_hand.txt” are present in working directory or not.

When running my program without debugger (Ctrl+F5), execution continues successfully. While debugging, I can still press Continue and move on. I understand that you may use C++ exceptions internally in the SDK and this is OK. But please note that configuring Visual Studio debugger to break when any exception is thrown is a useful feature, while this SDK behavior interferes with it. Moreover, using exceptions is often recommended for reporting serious errors, not just a state in normal program flow. So I think it would be nice if SDK didn’t throw this exception at every program startup.

Interesting. We use the cpptoml library to parse our configuration files at the moment which is the culprit throwing the exception. I agree that throwing exceptions during initialization is poor form and specifically can be extremely frustrating in VS C++. The issue you are experience seems to stem from either a missing or invalid astra.toml in your build directory. If you were to place one in that folder, you should see this exception disappear. I will look into avoiding this exception all together if the astra.toml (which is optional) is missing.