laptop and a wrench

Erro

Layer.SetExpanded(true) creates duplicate group layer items in the Contents pane in ArcGIS Pro 2.8.x but works fine in ArcGIS Pro 2.7.x.

Última Publicação: October 13, 2021 ArcGIS Pro SDK for .NET
Número de ID do Erro BUG-000143582
EnviadoOctober 11, 2021
Última ModificaçãoJune 19, 2025
Aplica-se àArcGIS Pro SDK for .NET
Versão encontrada2.8
Sistema OperacionalWindows OS
Versão do Sistema Operacional10.0 64 Bit
StatusWill Not Be Addressed

Informações Adicionais

Here are a few changes that the submitter can make to remove potential deadlocks and the System.Threading.Tasks.Task. I do not recommend the approach being used in the repro. I cannot reproduce it with the code consolidated/refactored as below. These changes/recommendations to the code are all explained here: https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Asynchronous-Programming-in-ArcGIS-Pro //Button1 implementation protected async override void OnClick() { var loops = 20; //we use a single queuedtask that is _awaited_ not "Wait" //Class2_Add_Batch_Magic is implemented with synchronous //methods var N = await QueuedTask.Run(() => { Class2_Add_Batch_Magic class2_Add_Batch_Magic = new Class2_Add_Batch_Magic(); return class2_Add_Batch_Magic.GO(loops); }); //Show modal UI outside the context of the QTR MessageBox.Show(String.Format("Complete {0} Loops, Duplicates = {1}", loops, N)); } //Note that all methods are converted to synchronous internal class Class2_Add_Batch_Magic { //The use of System.Threading.Tasks.Task is removed public int GO(int loops = 20) { return Run(loops); } private int Run(int loops) { return TestLoop(loops); } //Must be called within the context of a QTR or a //CalledOnWrongThreadException will be thrown from //LayerFactory.Instance.CreateGroupLayer... private int TestLoop(int loops) { int N = 0; for (int i = 0; i < loops; i++) { N += Nest1(i); } return N; //MessageBox.Show(String.Format("Complete {0} Loops, Duplicates = {1}", loops, N)); } private int Nest1(int index) { int N = 0; N = Nest2(index); return N; } private int Nest2(int index) { int N = 0; N = Make_Both(index); return N; } private int Make_Both(int index) { var pMagic = MakeGroup("Magic_" + index, null); var pBatch = MakeGroup("Batch_" + index, pMagic); Layer_Visible(pBatch, false); Layer_Expands(pBatch, false); return pMagic.Layers.Count - 1; } private GroupLayer MakeGroup(string Name, GroupLayer Parent) { ILayerContainerEdit Group = Parent; if (Group == null) { if (MapView.Active == null) return null; else Group = MapView.Active?.Map; } Parent = LayerFactory.Instance.CreateGroupLayer(Group, 0, "A_" + Name + "_Z"); Parent.SetName(Name); Layer_Expands(Parent, true); Layer_Visible(Parent, true); return Parent; } private void Layer_Expands(Layer pLayer, bool Value) { pLayer.SetExpanded(Value); } private void Layer_Visible(Layer pLayer, bool Value) { pLayer.SetVisibility(Value); } }

Etapas para Reproduzir

ID do Erro: BUG-000143582

Software:

  • ArcGIS Pro SDK for .NET

Seja notificado quando o status de um erro mudar

Baixe o Aplicativo de Suporte da Esri

Descubra mais sobre este tema

Obtenha ajuda de especialistas do ArcGIS

Entre em contato com Suporte Técnico

Baixe o Aplicativo de Suporte da Esri

Ir para as opções de download