KevinSayer

Bug in EditGeometry Class when moving polygons and polylines

Discussion created by KevinSayer on Mar 14, 2012
Latest reply on Mar 16, 2012 by KevinSayer
There seems to be a bug in the EditGeometry class and I thought I'd post my findings on here to see if anyone else has experienced this problem and whether there may be some kind of work around.

The problem is that when moving a polygon or polyline, if you move it back over exactly the same position it was in when the edit started, it automatically cancels the edit. This happens because points in the original geometry are being updated. As Jennifer has pointed out in other threads, canceling the edit as a result of updating the original geometry is by design but the question is, why is the original geometry getting updated? This is happening inside the EditGeometry class and isn't related to my use of the class as it happens in simple, stripped down examples, including those that Jennifer has posted herself. (See the post dated 01-09-2012 04:17pm in this thread.) I'd suggest lining the vertices of the polygon up with the edge of the window before starting the move so that it's easier to return to the exact starting location.

Below is the call stack from inside the GeometryEdited handler after the Cancel occurs:

> EsriEditing.exe!EsriEditing.MainWindow.mEditGeometry_GeometryEdit(object sender, ESRI.ArcGIS.Client.EditGeometry.GeometryEditEventArgs e) Line 83 C#
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.OnGeometryEdit(ESRI.ArcGIS.Client.Graphic g, ESRI.ArcGIS.Client.Geometry.MapPoint newItem, ESRI.ArcGIS.Client.Geometry.MapPoint oldItem, ESRI.ArcGIS.Client.EditGeometry.Action action) + 0x5f bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.StopEdit(bool deletingVertex, bool cancelEdit) + 0x227 bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.CancelEdit() + 0x21 bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.OriginalGeometry_GeometryChanged(object sender, System.EventArgs e) + 0x63 bytes
[Native to Managed Transition]
[Managed to Native Transition]
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.Geometry.Geometry.raiseGeometryChanged() + 0x4f bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.Geometry.Polygon.coll_PointChanged(object sender, System.EventArgs e) + 0x4f bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.Geometry.PointCollection.raisePointChanged() + 0x57 bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.Geometry.PointCollection.point_GeometryChanged(object sender, System.EventArgs e) + 0x60 bytes
[Native to Managed Transition]
[Managed to Native Transition]
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.Geometry.Geometry.raiseGeometryChanged() + 0x4f bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.Geometry.MapPoint.Y.set(double value) + 0x53 bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.Offset(ESRI.ArcGIS.Client.Geometry.MapPoint p, double dx, double dy) + 0x69 bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.Offset(ESRI.ArcGIS.Client.Geometry.PointCollection pnts, double dx, double dy) + 0x7c bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.Offset(System.Collections.Generic.IEnumerable<ESRI.ArcGIS.Client.Geometry.PointCollection> pntsColl, double dx, double dy) + 0x7b bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.Offset(ESRI.ArcGIS.Client.Geometry.Geometry g, double dx, double dy) + 0x5c bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.HandleElementMove(System.Windows.Point screenPoint, ESRI.ArcGIS.Client.Geometry.MapPoint mapPoint) + 0x17e bytes
ESRI.ArcGIS.Client.dll!ESRI.ArcGIS.Client.EditGeometry.Map_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) + 0x10c bytes
PresentationCore.dll!System.Windows.Input.MouseEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x34 bytes
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x27 bytes
PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) + 0x1bf bytes
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) + 0x79 bytes
PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args, bool trusted) + 0x35 bytes
PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() + 0x311 bytes
PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) + 0x42 bytes
PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) + 0x62 bytes
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) + 0x2e2 bytes
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x22b bytes
PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x75 bytes
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xbe bytes
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x7a bytes
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, bool isSingleParameter) + 0x8a bytes
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) + 0x4a bytes
WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) + 0x44 bytes
WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, bool isSingleParameter) + 0x91 bytes
WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority priority, System.Delegate method, object arg) + 0x40 bytes
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) + 0xdc bytes
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) + 0xc4 bytes
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes
WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x4c bytes
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) + 0x1e bytes
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x6f bytes
PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x26 bytes
PresentationFramework.dll!System.Windows.Application.Run() + 0x19 bytes
EsriEditing.exe!EsriEditing.App.Main() + 0x5e bytes C#
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x3a bytes
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2b bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes

Hopefully you will see this Jennifer and can either confirm the bug or explain the behaviour.

Regards,
Kevin

Outcomes