Select to view content in your preferred language

Addin with ArcGIS Pro 3.3

253
2
Jump to solution
4 weeks ago
GrégoireC
New Contributor III

Hello,

I used a plugin in ArcGIS Pro 3.2, and after migrating it to ArcGIS Pro 3.3, my esriaddinx plugin no longer worked. When I examined the source code, I noticed a new error message:

Error message : "Gravité Code Description Projet Fichier Ligne État de la suppression
Erreur CS0508 'ShowCoordinatesTool.HandleMouseDownAsync(MapViewMouseButtonEventArgs)' : le type de retour doit être 'Task' pour correspondre au membre substitué"

in English (translated) : "Severity Code Description Project File Line Deletion Status Error CS0508 'ShowCoordinatesTool.HandleMouseDownAsync(MapViewMouseButtonEventArgs)': return type must be 'Task' to match overridden member."

 

Did you notice the same issue ?

 

 

protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
{
....//Get the instance of the ViewModel
....var vm = OverlayEmbeddableControl as EmbeddedControlViewModel;
....if (vm == null)
........return Task.FromResult(0); //changé le 23/05/2024 pour test
........//return Task.CompletedTask;

....//Get the map coordinates from the click point and set the property on the ViewModel.
....return QueuedTask.Run(() =>
....{
........var mapPoint = ActiveMapView.ClientToMap(e.ClientPoint);
........var coords = GeometryEngine.Instance.Project(mapPoint, SpatialReferences.WGS84) as MapPoint;
........if (coords == null) return;

........var camera = ActiveMapView.Camera;

........var sb = new StringBuilder();
....
........var zoom = calculateZoom(96,Convert.ToInt32(camera.Scale),(float)coords.X,1);
........zoom = 100;

........vm.Text = sb.ToString();
........string YXZcoordinates = coords.Y.ToString().Replace(",", ".") + "," + coords.X.ToString().Replace(",", ".") + "," + zoom.ToString()+"m";

....});
....

GrgoireCATINEAU_0-1716479781267.png

 

0 Kudos
1 Solution

Accepted Solutions
GrégoireC
New Contributor III

I resolved this problem by changing of the .NET version 6 to 8 in the .csporj file of the old vs addin project

<TargetFramework>net6.0-windows</TargetFramework>

to

<TargetFramework>net8.0-windows</TargetFramework>

View solution in original post

0 Kudos
2 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

I cannot duplicate your issue.   When you say you migrated your add-in to 3.3 did you upgrade your project to target .NET 8.0?  I have a 3.1 add-in with a MapTool that also is using the HandleMouseDownAsync  overrise and it worked fine under 3.3.   When i migrated the project to ArcGIS Pro 3.3 i get the following when i hover over the HandleMouseDownAsync override:

Wolf_0-1716570162789.png

Also can you check the definition for Task?  It should be defined as follows:

Wolf_1-1716570650659.png

 

GrégoireC
New Contributor III

I resolved this problem by changing of the .NET version 6 to 8 in the .csporj file of the old vs addin project

<TargetFramework>net6.0-windows</TargetFramework>

to

<TargetFramework>net8.0-windows</TargetFramework>

0 Kudos