I am running Visual Studio 2022 - Version 17.7.1
I am running ARC GIS pro 3.1.0
I created a simple c# addin from the ArcGIS Pro Module Addin from a template in Visual Studio.
I added a button and in the onclick event I have this code
protected override void OnClick() { //Get the active map view. var mapView = MapView.Active; if (mapView == null) return; }
This code works and I can see properties of the mapView if I set a breakpoint.
However I can't call the method below since it needs to be run on the main thread.
var selectedFeatures = mapView.Map.GetSelection();
Changing my code to the following and using QueuedTask.Run allows this to work and it does indeed flash the selected object.
protected override void OnClick() { QueuedTask.Run(() => { //Get the active map view. var mapView = MapView.Active; if (mapView == null) return; var selectedFeatures = mapView.Map.GetSelection(); //Flash the collection of features. mapView.FlashFeature(selectedFeatures); }); }
But if I put a breakpoint within the QueuedTask.Run body I get a stack overflow error when trying to view most object properties
So the code works but I cant see any properties while debugging. I have no idea what is causing this and hence I can't actually write my plugin.
Cannot evaluate expression because the current thread is in a stack overflow state.
Hopefully someone has an idea?