StyleProjectItem method SearchColorRamps always returns empty array of ramps on ArcGIS Pro SDK 2.9

511
1
02-03-2022 01:04 AM
GKmieliauskas
Esri Regular Contributor

It was working until ArcGIS Pro 2.7 SDK. 
ArcGIS Pro SDK community sample Raster Colorizer doesn't work too.
It throws exception:
System.ArgumentOutOfRangeException
  HResult=0x80131502
  Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  Source=mscorlib
  StackTrace:
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Colorizer.BtnNewColor.<>c__DisplayClass0_0.<OnClick>b__0() in D:\ArcGIS_SDK_Samples\arcgis-pro-sdk-community-samples-master\Raster\Colorizer\BtnNewColor.cs:line 54
   at System.Threading.Tasks.Task.Execute()

0 Kudos
1 Reply
GKmieliauskas
Esri Regular Contributor

It was issue with ArcGIS Pro project file. Save as didn't solve the issue. I have recreated project from scratch and now it works fine.

I have extracted both projects to files. There is CIMProjectItem record in GISProject.xml file which is related to ArcGIS Colors. In damaged project CatalogPath setting is equal to full project path + ArcGIS Colors:

<CatalogPath>C:\MyProject\Project\ArcGIS Colors</CatalogPath> 

In working project:

  <CatalogPath>ArcGIS Colors</CatalogPath> 

The same situation with ColorBrewer Schemes (RGB).