AnsweredAssumed Answered

Completing the SketchEditor with a double click sometimes causes the application to crash

Question asked by hashagen_j on Aug 15, 2018
Latest reply on Aug 21, 2018 by bradyh30

I'm using the SketchEditor for editing an existing geometry and completing the modification with a double click.

[...]
this.view.MouseDoubleClick += this.ViewOnMouseDoubleClickWhileSketching;
geometry = await this.view.SketchEditor.StartAsync(this.SketchMode, configuration).ConfigureAwait(true);
[...]

private async void ViewOnMouseDoubleClickWhileSketching(object sender, MouseButtonEventArgs e)
{
    try
    {          
        // this.IsValid evaluates if the geometry is valid on all changes of the editor.
     if (this.IsValid && this.view.SketchEditor.CompleteCommand.CanExecute(null))
     {
         this.view.SketchEditor.CompleteCommand.Execute(null);
     }
    }
    catch (Exception exception)
    {
        [...]
    }
}

 

Sometimes the double click causes the following exception being thrown. This exception is causing the whole application to crash:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Esri.ArcGISRuntime.UI.SketchEditor.UpdateNewGeometry(MapPoint point, Boolean useFeedbackGraphic)
   at Esri.ArcGISRuntime.UI.SketchEditor.AddVertexToPartCollection(MapPoint mapPoint, VertexPosition vertexPosition)
   at Esri.ArcGISRuntime.UI.SketchEditor.AddPoint(MapPoint mapPoint)
   at Esri.ArcGISRuntime.UI.SketchEditor.<MapView_GeoViewTapped>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
[...]

Outcomes