the missing CurrentTool value in the Default.pro file raises an exception (System.FormatException), rather than get the default value.
What causes the exception is that the key is missing and so the Readkey function will give the default value (3rd parameter of the function) to the key,
but your default value is a boolean type and then you trying to convert the boolean "False" value into integer which raises the exception, because False value is not Int32 type.
Ofcourse you could handle this as you do now with exception handling, but we've made the default value parameter of the Readkey function to handle this case, so it is more elegant to give a proper default value to the key.
The UCCNC will write the value into your profile. It will not leave the key in the profile empty except if the value you writting is an empty string.
I've noticed one thing is that you starting a Thread in the constructor macro which is OK, but I thought to mention to not start a Thread like that in the Destructor (I don't know if you doing or did that just thought to mention as a possible problem).
The issue if you starting a Thread in the Destructor is that when the main Thread code of the Destructor macro will finish then the UCCNC will start closing and if your Thread is a backgroundworker then that will be stopped when the UCCNC closes, so the Thread may not able to finish it's work and if it started writting, but meanwhile the UCCNC Closed that will be an issue, it could possibly leave an empty value key.
And if your Thread is not a backgroundworker then strange things may happen, likely the UCCNC will not close until your Thread finishes, but this is not guaranteed to always happen like that.
So, do not start Threads in the destructor macro is the key.