FeatureLayer.AddLabelClass ignores passed class name

103
3
06-06-2019 03:34 AM
MaxMax2
Occasional Contributor II

FeatureLayer.AddLabelClass always adds label class with Class 1 name ignoring the name passed to the method. Am I missing something?

Tags (1)
0 Kudos
3 Replies
UmaHarano
Esri Regular Contributor

Hi Max

I couldn't reproduce this problem. I was able to add a new Label Class using this method. The Label Class has the name passed to the AddLabelClass method.  Can you please share a code snippet?

Thanks

Uma

0 Kudos
MaxMax2
Occasional Contributor II

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:

  1. Make request for adding label class and return control to calling thread
  2. Somewhere in the future class will be added with Class 1 name
  3. 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.

0 Kudos
NarelleChedzey
Esri Contributor

Hi Max, 

I can duplicate your problem using ArcGIS Pro 2.3 Final.   However using the exact same code I am unable to see the same problem in a pre-2.4 build.   ArcGIS Pro 2.4 will be released shortly.   Please let us know if you continue to see this problem when you upgrade to ArcGIS Pro 2.4

Thanks

Narelle

0 Kudos