I've performed more testing and results even more interesting. It seems AddLabelClass method actually just do kind of request to add class, but doesn't add it actually. Here is screenshot:
If I try to get added class immediately after AddLabelClass, LabelClasses collection will not contain it! But after couple of seconds:
So now it's OK...
In the middle between these two points in time class is added but has Class 1 name. So the entire process in SDK looks like this:
- Make request for adding label class and return control to calling thread
- Somewhere in the future class will be added with Class 1 name
- Somewhere in the future name will be changed to passed to AddLabelClass
It's absolutely unobvious that AddLabelClass exits without class actually added. These "somewhere in the future" are not good.