ArcGIS Pro SDK 2.3 Select

1074
7
02-19-2019 10:22 AM
MatthewDriscoll
MVP Alum

The process to select by using Sketch tools is not working in 2.3.  I double checked to make sure it was not just my code by downloading a fresh set of the samples from here GitHub - Esri/arcgis-pro-sdk-community-samples: ArcGIS Pro SDK for Microsoft .NET Framework Communit... and ran of the Feature Selection and the Map Tool Select without changing a thing and they both fail.   Is there a known fix to this?

0 Kudos
7 Replies
UmaHarano
Esri Regular Contributor

Hi Matthew

When you use the sketch tools with 2.3, are you seeing an exception thrown by the code or that nothing gets selected on the map?

Thanks

Uma

0 Kudos
MatthewDriscoll
MVP Alum

No exception thrown.  It sits and spins for 5-10 minutes, all others tools are grayed out, the refresh spins, and nothing gets selected.   All features are in a sde database.  

0 Kudos
UmaHarano
Esri Regular Contributor

When you use the Pro sketch tools (Map Tab on the ribbon) to select on your sde database features, does that work?  Is it only the custom sketch tools in samples and add-ins that are exhibiting this behavior?

0 Kudos
MatthewDriscoll
MVP Alum

Correct.  Normal out of the box works fine.  My custom code and the ESRI samples code downloaded from GitHub fails.   Worked fine in 2.2.

0 Kudos
UmaHarano
Esri Regular Contributor

Hi Matthew

I am not seeing this problem with custom sketch tools using Pro 2.3 on my system. I am able to run the Map Tool Select sample and select features with file GDB and SDE databases.

Can you please copy and paste the code for the MapToolSelect class from the Map tool select sample? 

Thanks

Uma

0 Kudos
MatthewDriscoll
MVP Alum

I renamed the root folders and reinstalled the software and it has helped a lot.   Still a bit slow but manageable. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Mapping;

namespace MapToolSelect
{
    internal class MapToolSelect : MapTool
    {
        public MapToolSelect()
        {
            IsSketchTool = true;
            SketchType = SketchGeometryType.Rectangle;
            SketchOutputMode = SketchOutputMode.Screen;
        }

        protected override Task OnToolActivateAsync(bool active)
        {
            return base.OnToolActivateAsync(active);
        }

        protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
        {
            return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
            {
        // Using the active map view to select
        // the features that intersect the sketch geometry
        ActiveMapView.SelectFeatures(geometry);
                return true;
            });
        }
    }
}
0 Kudos
MatthewDriscoll
MVP Alum

Uma,

    I think I am narrowing it down, I went into the ArcGISPro.exe.config and changed to

<supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.6.1"/>

Now all the add-ins I built work great but the out of the box ones do not.   I assume there is a setting in VS where I can set the framework version or write the correct one into the code somewhere?  If you have any experience or knowledge in this area I would appreciate the help, I am at a loss when I have to start getting into the XML system files.   

ArcObjects Help for .NET developers 

https://gis.stackexchange.com/questions/13606/why-cant-the-breakpoint-be-hit-when-debugging-an-arcgi...

0 Kudos